Module: Infusionsoft::Client::Email
- Included in:
- Infusionsoft::Client
- Defined in:
- lib/infusion-api/client/email.rb
Overview
The Email service allows you to email your contacts as well as attaching emails sent elsewhere (this lets you send email from multiple services and still see all communications inside of Infusionsoft).
Instance Method Summary collapse
-
#email_add(title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) ⇒ Object
Create a new email template that can be used for future emails.
-
#email_attach(contact_id, from_name, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body, header, receive_date, send_date) ⇒ Object
This will create an item in the email history for a contact.
-
#email_get_available_merge_fields(merge_context) ⇒ Array
This retrieves all possible merge fields for the context provided.
-
#email_get_opt_status(email_address) ⇒ Integer
Retrieves the status of the given email address.
-
#email_get_template(id) ⇒ Hash
Retrieves the details for a particular email template.
-
#email_optin(email_address, reason) ⇒ Boolean
This method opts-in an email address.
-
#email_optout(email_address, reason) ⇒ Boolean
Opts-out an email address.
-
#email_send(contact_list, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, text_body) ⇒ Boolean
This will send an email to a list of contacts, as well as record the email in the contacts’ email history.
-
#email_update_template(id, title, category, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) ⇒ Boolean
This method is used to update an already existing email template.
Instance Method Details
#email_add(title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) ⇒ Object
Create a new email template that can be used for future emails
22 23 24 25 26 |
# File 'lib/infusion-api/client/email.rb', line 22 def email_add(title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) response = get('APIEmailService.addEmailTemplate', title, categories, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) end |
#email_attach(contact_id, from_name, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body, header, receive_date, send_date) ⇒ Object
This will create an item in the email history for a contact. This does not actually send the email, it only places an item into the email history. Using the API to instruct Infusionsoft to send an email will handle this automatically.
45 46 47 48 49 50 51 |
# File 'lib/infusion-api/client/email.rb', line 45 def email_attach(contact_id, from_name, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body, header, receive_date, send_date) response = get('APIEmailService.attachEmail', contact_id, from_name, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, txt_body, header, receive_date, send_date) end |
#email_get_available_merge_fields(merge_context) ⇒ Array
This retrieves all possible merge fields for the context provided.
57 58 59 |
# File 'lib/infusion-api/client/email.rb', line 57 def email_get_available_merge_fields(merge_context) response = get('APIEmailService.getAvailableMergeFields', merge_context) end |
#email_get_opt_status(email_address) ⇒ Integer
Retrieves the status of the given email address.
73 74 75 |
# File 'lib/infusion-api/client/email.rb', line 73 def email_get_opt_status(email_address) response = get('APIEmailService.getOptStatus', email_address) end |
#email_get_template(id) ⇒ Hash
Retrieves the details for a particular email template.
65 66 67 |
# File 'lib/infusion-api/client/email.rb', line 65 def email_get_template(id) response = get('APIEmailService.getEmailTemplate', id) end |
#email_optin(email_address, reason) ⇒ Boolean
This method opts-in an email address. This method only works the first time an email address opts-in.
85 86 87 |
# File 'lib/infusion-api/client/email.rb', line 85 def email_optin(email_address, reason) response = get('APIEmailService.optIn', email_address, reason) end |
#email_optout(email_address, reason) ⇒ Boolean
Opts-out an email address. Note that once an address is opt-out, the API cannot opt it back in.
95 96 97 |
# File 'lib/infusion-api/client/email.rb', line 95 def email_optout(email_address, reason) response = get('APIEmailService.optOut', email_address, reason) end |
#email_send(contact_list, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, text_body) ⇒ Boolean
This will send an email to a list of contacts, as well as record the email in the contacts’ email history.
112 113 114 115 116 117 |
# File 'lib/infusion-api/client/email.rb', line 112 def email_send(contact_list, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, text_body) response = get('APIEmailService.sendEmail', contact_list, from_address, to_address, cc_addresses, bcc_addresses, content_type, subject, html_body, text_body) end |
#email_update_template(id, title, category, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) ⇒ Boolean
This method is used to update an already existing email template.
134 135 136 137 138 |
# File 'lib/infusion-api/client/email.rb', line 134 def email_update_template(id, title, category, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) response = get('APIEmailService.updateEmailTemplate', title, category, from, to, cc, bcc, subject, text_body, html_body, content_type, merge_context) end |