+
+2. __[Fork](https://help.github.com/fork-a-repo/)__ the [sendgrid-python](https://github.com/sendgrid/sendgrid-python) repository:
+
+
+
+3. __Clone__ your fork via the following commands:
+
+```bash
+# Clone your fork of the repo into the current directory
+git clone https://github.com/your_username/sendgrid-python
+# Navigate to the newly cloned directory
+cd sendgrid-python
+# Assign the original repo to a remote called "upstream"
+git remote add upstream https://github.com/sendgrid/sendgrid-python
+```
+
+> Don't forget to replace *your_username* in the URL by your real GitHub username.
+
+4. __Create a new topic branch__ (off the main project development branch) to contain your feature, change, or fix:
+
+```bash
+git checkout -b ThanksThe SendGrid Team
", - "text": "Thanks,/n The SendGrid Team" + "html": "ThanksThe Twilio SendGrid Team
", + "text": "Thanks,/n The Twilio SendGrid Team" }, "sandbox_mode": { "enable": False @@ -2246,9 +2247,9 @@ data = { } } response = sg.client.mail.send.post(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` # MAIL SETTINGS @@ -2257,7 +2258,7 @@ print response.headers **This endpoint allows you to retrieve a list of all mail settings.** -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings @@ -2265,9 +2266,9 @@ Mail settings allow you to tell SendGrid specific things to do to every email th ```python params = {'limit': 1, 'offset': 1} response = sg.client.mail_settings.get(query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update address whitelist mail settings @@ -2275,7 +2276,7 @@ print response.headers The address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain example.com, and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/address_whitelist @@ -2289,9 +2290,9 @@ data = { ] } response = sg.client.mail_settings.address_whitelist.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve address whitelist mail settings @@ -2299,24 +2300,24 @@ print response.headers The address whitelist setting whitelists a specified email address or domain for which mail should never be suppressed. For example, you own the domain example.com, and one or more of your recipients use email@example.com addresses, by placing example.com in the address whitelist setting, all bounces, blocks, and unsubscribes logged for that domain will be ignored and sent as if under normal sending conditions. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/address_whitelist ```python response = sg.client.mail_settings.address_whitelist.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update BCC mail settings **This endpoint allows you to update your current BCC mail settings.** -When the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules. +When the BCC mail setting is enabled, Twilio SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/bcc @@ -2327,34 +2328,34 @@ data = { "enabled": False } response = sg.client.mail_settings.bcc.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve all BCC mail settings **This endpoint allows you to retrieve your current BCC mail settings.** -When the BCC mail setting is enabled, SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules. +When the BCC mail setting is enabled, Twilio SendGrid will automatically send a blind carbon copy (BCC) to an address for every email sent without adding that address to the header. Please note that only one email address may be entered in this field, if you wish to distribute BCCs to multiple addresses you will need to create a distribution group or use forwarding rules. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/bcc ```python response = sg.client.mail_settings.bcc.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update bounce purge mail settings **This endpoint allows you to update your current bounce purge settings.** -This setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists. +This setting allows you to set a schedule for Twilio SendGrid to automatically delete contacts from your soft and hard bounce suppression lists. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/bounce_purge @@ -2366,26 +2367,26 @@ data = { "soft_bounces": 5 } response = sg.client.mail_settings.bounce_purge.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve bounce purge mail settings **This endpoint allows you to retrieve your current bounce purge settings.** -This setting allows you to set a schedule for SendGrid to automatically delete contacts from your soft and hard bounce suppression lists. +This setting allows you to set a schedule for Twilio SendGrid to automatically delete contacts from your soft and hard bounce suppression lists. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/bounce_purge ```python response = sg.client.mail_settings.bounce_purge.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update footer mail settings @@ -2393,7 +2394,7 @@ print response.headers The footer setting will insert a custom footer at the bottom of the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/footer @@ -2405,9 +2406,9 @@ data = { "plain_content": "..." } response = sg.client.mail_settings.footer.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve footer mail settings @@ -2415,16 +2416,16 @@ print response.headers The footer setting will insert a custom footer at the bottom of the text and HTML bodies. Use the embedded HTML editor and plain text entry fields to create the content of the footers to be inserted into your emails. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/footer ```python response = sg.client.mail_settings.footer.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update forward bounce mail settings @@ -2432,7 +2433,7 @@ print response.headers Activating this setting allows you to specify an email address to which bounce reports are forwarded. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/forward_bounce @@ -2443,9 +2444,9 @@ data = { "enabled": True } response = sg.client.mail_settings.forward_bounce.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve forward bounce mail settings @@ -2453,16 +2454,16 @@ print response.headers Activating this setting allows you to specify an email address to which bounce reports are forwarded. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/forward_bounce ```python response = sg.client.mail_settings.forward_bounce.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update forward spam mail settings @@ -2470,7 +2471,7 @@ print response.headers Enabling the forward spam setting allows you to specify an email address to which spam reports will be forwarded. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/forward_spam @@ -2481,9 +2482,9 @@ data = { "enabled": False } response = sg.client.mail_settings.forward_spam.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve forward spam mail settings @@ -2491,16 +2492,16 @@ print response.headers Enabling the forward spam setting allows you to specify an email address to which spam reports will be forwarded. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/forward_spam ```python response = sg.client.mail_settings.forward_spam.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update plain content mail settings @@ -2508,7 +2509,7 @@ print response.headers The plain content setting will automatically convert any plain text emails that you send to HTML before sending. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/plain_content @@ -2518,9 +2519,9 @@ data = { "enabled": False } response = sg.client.mail_settings.plain_content.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve plain content mail settings @@ -2528,16 +2529,16 @@ print response.headers The plain content setting will automatically convert any plain text emails that you send to HTML before sending. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/plain_content ```python response = sg.client.mail_settings.plain_content.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update spam check mail settings @@ -2545,7 +2546,7 @@ print response.headers The spam checker filter notifies you when emails are detected that exceed a predefined spam threshold. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/spam_check @@ -2557,9 +2558,9 @@ data = { "url": "url" } response = sg.client.mail_settings.spam_check.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve spam check mail settings @@ -2567,16 +2568,16 @@ print response.headers The spam checker filter notifies you when emails are detected that exceed a predefined spam threshold. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/spam_check ```python response = sg.client.mail_settings.spam_check.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update template mail settings @@ -2586,7 +2587,7 @@ This setting refers to our original email templates. We currently support more f The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### PATCH /mail_settings/template @@ -2597,9 +2598,9 @@ data = { "html_content": "<% body %>" } response = sg.client.mail_settings.template.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve legacy template mail settings @@ -2609,16 +2610,16 @@ This setting refers to our original email templates. We currently support more f The legacy email template setting wraps an HTML template around your email content. This can be useful for sending out marketing email and/or other HTML formatted messages. -Mail settings allow you to tell SendGrid specific things to do to every email that you send to your recipients over SendGrids [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). +Mail settings allow you to tell Twilio SendGrid specific things to do to every email that you send to your recipients over Twilio SendGrid's [Web API](https://sendgrid.com/docs/API_Reference/Web_API/mail.html) or [SMTP Relay](https://sendgrid.com/docs/API_Reference/SMTP_API/index.html). ### GET /mail_settings/template ```python response = sg.client.mail_settings.template.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` # MAILBOX PROVIDERS @@ -2637,9 +2638,9 @@ Advanced Stats provide a more in-depth view of your email statistics and the act ```python params = {'end_date': '2016-04-01', 'mailbox_providers': 'test_string', 'aggregated_by': 'day', 'limit': 1, 'offset': 1, 'start_date': '2016-01-01'} response = sg.client.mailbox_providers.stats.get(query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` # PARTNER SETTINGS @@ -2648,7 +2649,7 @@ print response.headers **This endpoint allows you to retrieve a list of all partner settings that you can enable.** -Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). +Our partner settings allow you to integrate your Twilio SendGrid account with our partners to increase your Twilio SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). ### GET /partner_settings @@ -2656,17 +2657,17 @@ Our partner settings allow you to integrate your SendGrid account with our partn ```python params = {'limit': 1, 'offset': 1} response = sg.client.partner_settings.get(query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Updates New Relic partner settings. **This endpoint allows you to update or change your New Relic partner settings.** -Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). +Our partner settings allow you to integrate your Twilio SendGrid account with our partners to increase your Twilio SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). -By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html). +By integrating with New Relic, you can send your Twilio SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html). ### PATCH /partner_settings/new_relic @@ -2678,26 +2679,26 @@ data = { "license_key": "" } response = sg.client.partner_settings.new_relic.patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Returns all New Relic partner settings. **This endpoint allows you to retrieve your current New Relic partner settings.** -Our partner settings allow you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). +Our partner settings allow you to integrate your Twilio SendGrid account with our partners to increase your Twilio SendGrid experience and functionality. For more information about our partners, and how you can begin integrating with them, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/partners.html). -By integrating with New Relic, you can send your SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html). +By integrating with New Relic, you can send your Twilio SendGrid email statistics to your New Relic Dashboard. If you enable this setting, your stats will be sent to New Relic every 5 minutes. You will need your New Relic License Key to enable this setting. For more information, please see our [Classroom](https://sendgrid.com/docs/Classroom/Track/Collecting_Data/new_relic.html). ### GET /partner_settings/new_relic ```python response = sg.client.partner_settings.new_relic.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` # SCOPES @@ -2706,16 +2707,16 @@ print response.headers **This endpoint returns a list of all scopes that this user has access to.** -API Keys can be used to authenticate the use of [SendGrids v3 Web API](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html), or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissions, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/api_keys.html#-API-Key-Permissions) or [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html). +API Keys can be used to authenticate the use of [Twilio SendGrid's v3 Web API](https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html), or the [Mail API Endpoint](https://sendgrid.com/docs/API_Reference/Web_API/mail.html). API Keys may be assigned certain permissions, or scopes, that limit which API endpoints they are able to access. For a more detailed explanation of how you can use API Key permissions, please visit our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/api_keys.html#-API-Key-Permissions) or [Classroom](https://sendgrid.com/docs/Classroom/Basics/API/api_key_permissions.html). ### GET /scopes ```python response = sg.client.scopes.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` # SENDERS @@ -2726,7 +2727,7 @@ print response.headers *You may create up to 100 unique sender identities.* -Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. +Sender Identities are required to be verified before use. If your domain has been authenticated it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. ### POST /senders @@ -2750,30 +2751,30 @@ data = { "zip": "80202" } response = sg.client.senders.post(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Get all Sender Identities **This endpoint allows you to retrieve a list of all sender identities that have been created for your account.** -Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. +Sender Identities are required to be verified before use. If your domain has been authenticated it will auto verify on creation. Otherwise an email will be sent to the `from.email`. ### GET /senders ```python response = sg.client.senders.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update a Sender Identity **This endpoint allows you to update a sender identity.** -Updates to `from.email` require re-verification. If your domain has been whitelabeled it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. +Updates to `from.email` require re-verification. If your domain has been authenticated it will auto verify on creation. Otherwise an email will be sent to the `from.email`. Partial updates are allowed, but fields that are marked as "required" in the POST (create) endpoint must not be nil if that field is included in the PATCH request. @@ -2800,15 +2801,15 @@ data = { } sender_id = "test_url_param" response = sg.client.senders._(sender_id).patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## View a Sender Identity **This endpoint allows you to retrieve a specific sender identity.** -Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. +Sender Identities are required to be verified before use. If your domain has been authenticated it will auto verify on creation. Otherwise an email will be sent to the `from.email`. ### GET /senders/{sender_id} @@ -2816,15 +2817,15 @@ Sender Identities are required to be verified before use. If your domain has bee ```python sender_id = "test_url_param" response = sg.client.senders._(sender_id).get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Delete a Sender Identity **This endpoint allows you to delete one of your sender identities.** -Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. +Sender Identities are required to be verified before use. If your domain has been authenticated it will auto verify on creation. Otherwise an email will be sent to the `from.email`. ### DELETE /senders/{sender_id} @@ -2832,15 +2833,15 @@ Sender Identities are required to be verified before use. If your domain has bee ```python sender_id = "test_url_param" response = sg.client.senders._(sender_id).delete() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Resend Sender Identity Verification **This endpoint allows you to resend a sender identity verification email.** -Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise, an email will be sent to the `from.email`. +Sender Identities are required to be verified before use. If your domain has been authenticated it will auto verify on creation. Otherwise an email will be sent to the `from.email`. ### POST /senders/{sender_id}/resend_verification @@ -2848,24 +2849,25 @@ Sender Identities are required to be verified before use. If your domain has bee ```python sender_id = "test_url_param" response = sg.client.senders._(sender_id).resend_verification.post() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` + -# Sender Authentication +# SENDER AUTHENTICATION -## Create a new domain authentication. +## Create an authenticated domain. -**This endpoint allows you to create an authenticated domain.** +**This endpoint allows you to create a domain authentication for one of your domains.** If you are creating a domain authentication that you would like a subuser to use, you have two options: -1. Use the "username" parameter. This allows you to create a domain authentication on behalf of your subuser. This means the subuser is able to see and modify the created domain authentication. -2. Use the Association workflow (see Associate Domain section). This allows you to assign a Domain Authentication created by the parent to a subuser. This means the subuser will default to the assigned authenticated domain, but will not be able to see or modify that Authentication. However, if the subuser creates their own Domain Authentication it will overwrite the assigned Domain Authentication. +1. Use the "username" parameter. This allows you to create a domain authentication on behalf of your subuser. This means the subuser is able to see and modify the created authentication. +2. Use the Association workflow (see Associate Domain section). This allows you to assign a domain authentication created by the parent to a subuser. This means the subuser will default to the assigned domain authentication, but will not be able to see or modify that authentication. However, if the subuser creates their own domain authentication it will overwrite the assigned domain authentication. -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ### POST /whitelabel/domains @@ -2884,19 +2886,17 @@ data = { "username": "john@example.com" } response = sg.client.whitelabel.domains.post(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## List all Domain Authentications. +## List all domain authentications. **This endpoint allows you to retrieve a list of all domain authentications you have created.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. - - -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ### GET /whitelabel/domains @@ -2905,87 +2905,87 @@ For more information on domain authentication, please see our [User Guide](https ```python params = {'username': 'test_string', 'domain': 'test_string', 'exclude_subusers': 'true', 'limit': 1, 'offset': 1} response = sg.client.whitelabel.domains.get(query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Get the default domain authentication. -**This endpoint allows you to retrieve the default authentication for a domain.** +**This endpoint allows you to retrieve the default default authentication for a domain.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Description | |---|---|---| -| domain | string |The domain to find a default domain whitelabel for. | +| domain | string |The domain to find a default domain authentication for. | ### GET /whitelabel/domains/default ```python response = sg.client.whitelabel.domains.default.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## List the domain authentications associated with the given user. +## List the domain authentication associated with the given user. **This endpoint allows you to retrieve all of the domain authentications that have been assigned to a specific subuser.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -Domain authentications can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's authenticated domains. To associate a domain authentication with a subuser, the parent account must first create the authentication and validate it. The parent may then associate the domain authentication via the subuser management tools. +Domain authentications can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's authenticated domains. To associate a domain authentication with a subuser, the parent account must first create the default authentication and validate it. The parent may then associate the default authentication via the subuser management tools. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Description | |---|---|---| -| username | string | Username of the subuser to find associated whitelabels for. | +| username | string | Username of the subuser to find associated domain authentications for. | ### GET /whitelabel/domains/subuser ```python response = sg.client.whitelabel.domains.subuser.get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Disassociate a domain authentication from a given user. -**This endpoint allows you to disassociate a specific authenticated domain from a subuser.** +**This endpoint allows you to disassociate a specific default authentication from a subuser.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -Domain authentications can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's authenticated domains. To associate a domain authentication with a subuser, the parent account must first create the authentication and validate it. The parent may then associate the domain authentication via the subuser management tools. +Domain authentications can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's authenticated domains. To associate a domain authentication with a subuser, the parent account must first create the default authentication and validate it. The parent may then associate the default authentication via the subuser management tools. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Required? | Description | |---|---|---|---| -| username | string | required | Username for the subuser to find associated whitelabels for. | +| username | string | required | Username for the subuser to find associated domain authentications for. | ### DELETE /whitelabel/domains/subuser ```python response = sg.client.whitelabel.domains.subuser.delete() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Update a domain authentication. **This endpoint allows you to update the settings for a domain authentication.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ### PATCH /whitelabel/domains/{domain_id} @@ -2997,17 +2997,17 @@ data = { } domain_id = "test_url_param" response = sg.client.whitelabel.domains._(domain_id).patch(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve a domain authentication. **This endpoint allows you to retrieve a specific domain authentication.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ### GET /whitelabel/domains/{domain_id} @@ -3016,17 +3016,17 @@ For more information on domain authentication, please see our [User Guide](https ```python domain_id = "test_url_param" response = sg.client.whitelabel.domains._(domain_id).get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Delete a domain authentication. **This endpoint allows you to delete a domain authentication.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ### DELETE /whitelabel/domains/{domain_id} @@ -3034,24 +3034,24 @@ For more information on domain authentication, please see our [User Guide](https ```python domain_id = "test_url_param" response = sg.client.whitelabel.domains._(domain_id).delete() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Associate a domain authentication with a given user. **This endpoint allows you to associate a specific domain authentication with a subuser.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -Domain authentications can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's authenticated domains. To associate a domain authentication with a subuser, the parent account must first create the authentication and validate it. The parent may then associate the domain authentication via the subuser management tools. +Domain authentications can be associated with (i.e. assigned to) subusers from a parent account. This functionality allows subusers to send mail using their parent's authenticated domains. To associate a domain authentication with a subuser, the parent account must first create the default authentication and validate it. The parent may then associate the default authentication via the subuser management tools. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Description | |---|---|---| -| domain_id | integer | ID of the domain whitelabel to associate with the subuser. | +| domain_id | integer | ID of the domain authentication to associate with the subuser. | ### POST /whitelabel/domains/{domain_id}/subuser @@ -3062,17 +3062,17 @@ data = { } domain_id = "test_url_param" response = sg.client.whitelabel.domains._(domain_id).subuser.post(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Add an IP to an authenticated domain. +## Add an IP to a domain authentication. -**This endpoint allows you to add an IP address to an authenticated domain.** +**This endpoint allows you to add an IP address to a domain authentication.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Description | @@ -3088,23 +3088,23 @@ data = { } id = "test_url_param" response = sg.client.whitelabel.domains._(id).ips.post(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Remove an IP from an authenticated domain. +## Remove an IP from a domain authentication. -**This endpoint allows you to remove a domain's IP address from an authenticated domain.** +**This endpoint allows you to remove a domain's IP address from that domain's authentication.** -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/)) +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Description | |---|---|---| -| id | integer | ID of the domain whitelabel to delete the IP from. | -| ip | string | IP to remove from the domain whitelabel. | +| id | integer | ID of the domain authentication to delete the IP from. | +| ip | string | IP to remove from the domain authentication. | ### DELETE /whitelabel/domains/{id}/ips/{ip} @@ -3113,23 +3113,22 @@ For more information on domain authentication, please see our [User Guide](https id = "test_url_param" ip = "test_url_param" response = sg.client.whitelabel.domains._(id).ips._(ip).delete() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Validate a domain authentication. -**This endpoint allows you to validate a domain authentication. If it fails, it will return an error message describing why the domain authentication could not be validated.** - -A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +**This endpoint allows you to validate a domain authentication. If it fails, it will return an error message describing why the default authentication could not be validated.** -For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/) +A domain authentication allows you to remove the via or sent on behalf of message that your recipients see when they read your emails. Authenticating a domain allows you to replace sendgrid.net with your personal sending domain. You will be required to create a subdomain so that Twilio SendGrid can generate the DNS records which you must give to your host provider. If you choose to use Automated Security, Twilio SendGrid will provide you with 3 CNAME records. If you turn Automated Security off, you will be given 2 TXT records and 1 MX record. +For more information on domain authentication, please see our [User Guide](https://sendgrid.com/docs/User_Guide/Settings/Whitelabel/index.html) ## URI Parameters | URI Parameter | Type | Description | |---|---|---| -| id | integer |ID of the domain whitelabel to validate. | +| id | integer |ID of the domain authentication to validate. | ### POST /whitelabel/domains/{id}/validate @@ -3137,17 +3136,18 @@ For more information on domain authentication, please see our [User Guide](https ```python id = "test_url_param" response = sg.client.whitelabel.domains._(id).validate.post() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Setup reverse DNS -**This endpoint allows you to setup reverse DNS.** +## Create reverse DNS record -When setting up reverse DNS, you should use the same subdomain that you used when you created a domain authentication. +**This endpoint allows you to create a reverse DNS record.** -Reverse DNS consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. +When creating a reverse DNS record, you should use the same subdomain that you used when you created a domain authentication. + +Reverse DNS consists of a subdomain and domain that will be used to generate a record for a given IP. Once Twilio SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/). @@ -3161,17 +3161,18 @@ data = { "subdomain": "email" } response = sg.client.whitelabel.ips.post(request_body=data) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` + ## Retrieve all reverse DNS records -**This endpoint allows you to retrieve all of the reverse DNS that have been created by this account.** +**This endpoint allows you to retrieve all of the reverse DNS records that have been created by this account.** You may include a search key by using the "ip" parameter. This enables you to perform a prefix search for a given IP segment (e.g. "192."). -Reverse DNS consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. +Reverse DNS consists of a subdomain and domain that will be used to generate a record for a given IP. Once Twilio SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/). @@ -3181,17 +3182,17 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/ui/a ```python params = {'ip': 'test_string', 'limit': 1, 'offset': 1} response = sg.client.whitelabel.ips.get(query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Retrieve an reverse DNS setting +## Retrieve a reverse DNS record -**This endpoint allows you to retrieve an reverse DNS setting.** +**This endpoint allows you to retrieve a reverse DNS record.** -Reverse DNS consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. +A reverse DNS record consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once Twilio SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. -For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/). +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). ### GET /whitelabel/ips/{id} @@ -3199,17 +3200,17 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/ui/a ```python id = "test_url_param" response = sg.client.whitelabel.ips._(id).get() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Delete an reverse DNS record +## Delete a reverse DNS record -**This endpoint allows you to delete an reverse DNS record.** +**This endpoint allows you to delete a reverse DNS record.** -Reverse DNS consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. +A reverse DNS record consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once Twilio SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. -For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/). +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). ### DELETE /whitelabel/ips/{id} @@ -3217,17 +3218,17 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/ui/a ```python id = "test_url_param" response = sg.client.whitelabel.ips._(id).delete() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Validate an reverse DNS record +## Validate a reverse DNS record -**This endpoint allows you to validate an reverse DNS record.** +**This endpoint allows you to validate a reverse DNS record.** -Reverse DNS consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. +A reverse DNS record consists of a subdomain and domain that will be used to generate a reverse DNS record for a given IP. Once Twilio SendGrid has verified that the appropriate A record for the IP has been created, the appropriate reverse DNS record for the IP is generated. -For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/). +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/ips.html). ### POST /whitelabel/ips/{id}/validate @@ -3235,17 +3236,17 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/ui/a ```python id = "test_url_param" response = sg.client.whitelabel.ips._(id).validate.post() -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Create Link Branding +## Create a Link Branding -**This endpoint allows you to create a new branded link.** +**This endpoint allows you to create a new link branding.** -Link branding allows all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. +Email link brandings allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. -For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/). +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). ### POST /whitelabel/links @@ -3258,17 +3259,17 @@ data = { } params = {'limit': 1, 'offset': 1} response = sg.client.whitelabel.links.post(request_body=data, query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` -## Retrieve all link brands +## Retrieve all link brandings -**This endpoint allows you to retrieve all branded links.** +**This endpoint allows you to retrieve all link brandings.** -Link branding allows all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. +Email link brandings allow all of the click-tracked links you send in your emails to include the URL of your domain instead of sendgrid.net. -For more information, please see our [User Guide](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/). +For more information, please see our [User Guide](https://sendgrid.com/docs/API_Reference/Web_API_v3/Whitelabel/links.html). ### GET /whitelabel/links @@ -3276,24 +3277,24 @@ For more information, please see our [User Guide](https://sendgrid.com/docs/ui/a ```python params = {'limit': 1} response = sg.client.whitelabel.links.get(query_params=params) -print response.status_code -print response.body -print response.headers +print(response.status_code) +print(response.body) +print(response.headers) ``` ## Retrieve a Default Link Branding **This endpoint allows you to retrieve the default link branding.** -Default link branding is the actual link whitelabel to be used when sending messages. If there are multiple branded links, the default is determined by the following order: +Default link branding is the actual link branding to be used when sending messages. If there are multiple link brandings, the default is determined by the following order:Hello, {{name}}! Your current balance is {{balance}}
-
- """
- mail = Mail()
- mail.from_email = Email('templates@sendgrid.com')
- mail.template_id = 'd-your-dynamic-template-uid'
- p = Personalization()
- p.add_to(Email('user@example.com'))
- p.dynamic_template_data = {
- 'name': 'Bob',
- 'balance': 42
- }
- mail.add_personalization(p)
-
- sg = SendGridAPIClient()
- response = sg.client.mail.send.post(request_body=mail.get())
- print(response.status_code)
- print(response.headers)
- print(response.body)
+## this will only send an email if you set SandBox Mode to False
+# send_kitchen_sink()
diff --git a/examples/helpers/stats/stats_example.py b/examples/helpers/stats/stats_example.py
index f3196881a..f22baa5c4 100644
--- a/examples/helpers/stats/stats_example.py
+++ b/examples/helpers/stats/stats_example.py
@@ -3,11 +3,11 @@
from sendgrid.helpers.stats import *
from sendgrid import *
-# NOTE: you will need move this file to the root directory of this project to execute properly.
+# NOTE: you will need to move this file to the root directory of this project to execute properly.
# Assumes you set your environment variable:
-# https://github.com/sendgrid/sendgrid-python/blob/master/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key
-sg = SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+# See: https://github.com/sendgrid/sendgrid-python/blob/HEAD/TROUBLESHOOTING.md#environment-variables-and-your-sendgrid-api-key
+sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
def pprint_json(json_raw):
diff --git a/examples/ips/ips.py b/examples/ips/ips.py
index 5d3e4e0bd..316d0c858 100644
--- a/examples/ips/ips.py
+++ b/examples/ips/ips.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve all IP addresses #
diff --git a/examples/mail/mail.py b/examples/mail/mail.py
index e853d422c..d2ccc80f0 100644
--- a/examples/mail/mail.py
+++ b/examples/mail/mail.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Create a batch ID #
@@ -28,7 +27,7 @@
# v3 Mail Send #
# POST /mail/send #
# This endpoint has a helper, check it out
-# [here](https://github.com/sendgrid/sendgrid-python/blob/master/sendgrid/helpers/mail/README.md).
+# [here](https://github.com/sendgrid/sendgrid-python/blob/HEAD/use_cases/README.md).
data = {
"asm": {
diff --git a/examples/mailboxproviders/mailboxproviders.py b/examples/mailboxproviders/mailboxproviders.py
index a95b388b4..4fbf470e2 100644
--- a/examples/mailboxproviders/mailboxproviders.py
+++ b/examples/mailboxproviders/mailboxproviders.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve email statistics by mailbox provider. #
diff --git a/examples/mailsettings/mailsettings.py b/examples/mailsettings/mailsettings.py
index e0d89b5fa..a4d46e399 100644
--- a/examples/mailsettings/mailsettings.py
+++ b/examples/mailsettings/mailsettings.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve all mail settings #
diff --git a/examples/partnersettings/partnersettings.py b/examples/partnersettings/partnersettings.py
index fa2589b55..d3675a6ba 100644
--- a/examples/partnersettings/partnersettings.py
+++ b/examples/partnersettings/partnersettings.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Returns a list of all partner settings. #
diff --git a/examples/scopes/scopes.py b/examples/scopes/scopes.py
index c9d4f1209..99519dc3e 100644
--- a/examples/scopes/scopes.py
+++ b/examples/scopes/scopes.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve a list of scopes for which this user has access. #
diff --git a/examples/senderauthentication/senderauthentication.py b/examples/senderauthentication/senderauthentication.py
index 99efc1b8b..f842d9302 100644
--- a/examples/senderauthentication/senderauthentication.py
+++ b/examples/senderauthentication/senderauthentication.py
@@ -3,10 +3,10 @@
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
-# Create a domain whitelabel. #
+# Create a domain authentication. #
# POST /whitelabel/domains #
data = {
@@ -27,7 +27,7 @@
print(response.headers)
##################################################
-# List all domain whitelabels. #
+# List all domain authentications. #
# GET /whitelabel/domains #
params = {'username': 'test_string', 'domain': 'test_string',
@@ -38,7 +38,7 @@
print(response.headers)
##################################################
-# Get the default domain whitelabel. #
+# Get the default domain authentication. #
# GET /whitelabel/domains/default #
response = sg.client.whitelabel.domains.default.get()
@@ -47,7 +47,7 @@
print(response.headers)
##################################################
-# List the domain whitelabel associated with the given user. #
+# List the domain authentication associated with the given user. #
# GET /whitelabel/domains/subuser #
response = sg.client.whitelabel.domains.subuser.get()
@@ -56,7 +56,7 @@
print(response.headers)
##################################################
-# Disassociate a domain whitelabel from a given user. #
+# Disassociate a domain authentication from a given user. #
# DELETE /whitelabel/domains/subuser #
response = sg.client.whitelabel.domains.subuser.delete()
@@ -65,7 +65,7 @@
print(response.headers)
##################################################
-# Update a domain whitelabel. #
+# Update a domain authentication. #
# PATCH /whitelabel/domains/{domain_id} #
data = {
@@ -79,7 +79,7 @@
print(response.headers)
##################################################
-# Retrieve a domain whitelabel. #
+# Retrieve a domain authentication. #
# GET /whitelabel/domains/{domain_id} #
domain_id = "test_url_param"
@@ -89,7 +89,7 @@
print(response.headers)
##################################################
-# Delete a domain whitelabel. #
+# Delete a domain authentication. #
# DELETE /whitelabel/domains/{domain_id} #
domain_id = "test_url_param"
@@ -99,7 +99,7 @@
print(response.headers)
##################################################
-# Associate a domain whitelabel with a given user. #
+# Associate a domain authentication with a given user. #
# POST /whitelabel/domains/{domain_id}/subuser #
data = {
@@ -113,7 +113,7 @@
print(response.headers)
##################################################
-# Add an IP to a domain whitelabel. #
+# Add an IP to a domain authentication. #
# POST /whitelabel/domains/{id}/ips #
data = {
@@ -126,7 +126,7 @@
print(response.headers)
##################################################
-# Remove an IP from a domain whitelabel. #
+# Remove an IP from a domain authentication. #
# DELETE /whitelabel/domains/{id}/ips/{ip} #
id_ = "test_url_param"
@@ -137,7 +137,7 @@
print(response.headers)
##################################################
-# Validate a domain whitelabel. #
+# Validate a domain authentication. #
# POST /whitelabel/domains/{id}/validate #
id_ = "test_url_param"
@@ -147,7 +147,7 @@
print(response.headers)
##################################################
-# Create an IP whitelabel #
+# Create a reverse DNS record #
# POST /whitelabel/ips #
data = {
@@ -161,7 +161,7 @@
print(response.headers)
##################################################
-# Retrieve all IP whitelabels #
+# Create a reverse DNS record #
# GET /whitelabel/ips #
params = {'ip': 'test_string', 'limit': 1, 'offset': 1}
@@ -171,7 +171,7 @@
print(response.headers)
##################################################
-# Retrieve an IP whitelabel #
+# Retrieve a reverse DNS record #
# GET /whitelabel/ips/{id} #
id_ = "test_url_param"
@@ -181,7 +181,7 @@
print(response.headers)
##################################################
-# Delete an IP whitelabel #
+# Delete a reverse DNS record #
# DELETE /whitelabel/ips/{id} #
id_ = "test_url_param"
@@ -191,7 +191,7 @@
print(response.headers)
##################################################
-# Validate an IP whitelabel #
+# Validate a reverse DNS record #
# POST /whitelabel/ips/{id}/validate #
id_ = "test_url_param"
@@ -201,7 +201,7 @@
print(response.headers)
##################################################
-# Create a Link Whitelabel #
+# Create a Link Branding #
# POST /whitelabel/links #
data = {
@@ -217,7 +217,7 @@
print(response.headers)
##################################################
-# Retrieve all link whitelabels #
+# Retrieve all link brandings #
# GET /whitelabel/links #
params = {'limit': 1}
@@ -227,7 +227,7 @@
print(response.headers)
##################################################
-# Retrieve a Default Link Whitelabel #
+# Retrieve a Default Link Branding #
# GET /whitelabel/links/default #
params = {'domain': 'test_string'}
@@ -237,7 +237,7 @@
print(response.headers)
##################################################
-# Retrieve Associated Link Whitelabel #
+# Retrieve Associated Link Branding #
# GET /whitelabel/links/subuser #
params = {'username': 'test_string'}
@@ -247,7 +247,7 @@
print(response.headers)
##################################################
-# Disassociate a Link Whitelabel #
+# Disassociate a Link Branding #
# DELETE /whitelabel/links/subuser #
params = {'username': 'test_string'}
@@ -257,7 +257,7 @@
print(response.headers)
##################################################
-# Update a Link Whitelabel #
+# Update a Link Branding #
# PATCH /whitelabel/links/{id} #
data = {
@@ -270,7 +270,7 @@
print(response.headers)
##################################################
-# Retrieve a Link Whitelabel #
+# Retrieve a Link Branding #
# GET /whitelabel/links/{id} #
id_ = "test_url_param"
@@ -280,7 +280,7 @@
print(response.headers)
##################################################
-# Delete a Link Whitelabel #
+# Delete a Link Branding #
# DELETE /whitelabel/links/{id} #
id_ = "test_url_param"
@@ -290,7 +290,7 @@
print(response.headers)
##################################################
-# Validate a Link Whitelabel #
+# Validate a Link Branding #
# POST /whitelabel/links/{id}/validate #
id_ = "test_url_param"
@@ -300,7 +300,7 @@
print(response.headers)
##################################################
-# Associate a Link Whitelabel #
+# Associate a Link Branding #
# POST /whitelabel/links/{link_id}/subuser #
data = {
diff --git a/examples/senders/senders.py b/examples/senders/senders.py
index f198a8f91..55eb44631 100644
--- a/examples/senders/senders.py
+++ b/examples/senders/senders.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Create a Sender Identity #
diff --git a/examples/stats/stats.py b/examples/stats/stats.py
index 4ddce6b75..cde422447 100644
--- a/examples/stats/stats.py
+++ b/examples/stats/stats.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve global email statistics #
diff --git a/examples/subusers/subusers.py b/examples/subusers/subusers.py
index 3d79bfb11..0f5ba6fe0 100644
--- a/examples/subusers/subusers.py
+++ b/examples/subusers/subusers.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Create Subuser #
diff --git a/examples/suppression/suppression.py b/examples/suppression/suppression.py
index 391dbe299..430f76f35 100644
--- a/examples/suppression/suppression.py
+++ b/examples/suppression/suppression.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve all blocks #
diff --git a/examples/templates/templates.py b/examples/templates/templates.py
index a370006b2..9b5210191 100644
--- a/examples/templates/templates.py
+++ b/examples/templates/templates.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Create a transactional template. #
diff --git a/examples/trackingsettings/trackingsettings.py b/examples/trackingsettings/trackingsettings.py
index 0c45e10d9..b3c49f8b2 100644
--- a/examples/trackingsettings/trackingsettings.py
+++ b/examples/trackingsettings/trackingsettings.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve Tracking Settings #
diff --git a/examples/user/user.py b/examples/user/user.py
index c7aabd4ac..5160f9ff8 100644
--- a/examples/user/user.py
+++ b/examples/user/user.py
@@ -1,9 +1,8 @@
import sendgrid
-import json
import os
-sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
+sg = sendgrid.SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
##################################################
# Get a user's account information. #
diff --git a/live_test.py b/live_test.py
new file mode 100644
index 000000000..d666140fb
--- /dev/null
+++ b/live_test.py
@@ -0,0 +1,357 @@
+## Send a Single Email to a Single Recipient
+import os
+import json
+from sendgrid import SendGridAPIClient
+from sendgrid.helpers.mail import Mail, From, To, Subject, PlainTextContent, HtmlContent, SendGridException
+
+message = Mail(from_email=From('help@twilio.com', 'Twilio SendGrid'),
+ to_emails=To('ethomas@twilio.com', 'Elmer Thomas'),
+ subject=Subject('Sending with SendGrid is Fun'),
+ plain_text_content=PlainTextContent('and easy to do anywhere, even with Python'),
+ html_content=HtmlContent('and easy to do anywhere, even with Python'))
+
+try:
+ print(json.dumps(message.get(), sort_keys=True, indent=4))
+ sendgrid_client = SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY'))
+ response = sendgrid_client.send(message=message)
+ print(response.status_code)
+ print(response.body)
+ print(response.headers)
+except SendGridException as e:
+ print(e.message)
+
+# Send a Single Email to Multiple Recipients
+import os
+import json
+from sendgrid import SendGridAPIClient
+from sendgrid.helpers.mail import Mail, From, To, Subject, PlainTextContent, HtmlContent, SendGridException
+
+to_emails = [
+ To('ethomas@twilio.com', 'Elmer SendGrid'),
+ To('elmer.thomas@gmail.com', 'Elmer Thomas')
+]
+message = Mail(from_email=From('help@twilio.com', 'Twilio SendGrid'),
+ to_emails=to_emails,
+ subject=Subject('Sending with SendGrid is Fun'),
+ plain_text_content=PlainTextContent('and easy to do anywhere, even with Python'),
+ html_content=HtmlContent('and easy to do anywhere, even with Python'))
+
+try:
+ print(json.dumps(message.get(), sort_keys=True, indent=4))
+ sendgrid_client = SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY'))
+ response = sendgrid_client.send(message=message)
+ print(response.status_code)
+ print(response.body)
+ print(response.headers)
+except SendGridException as e:
+ print(e.message)
+
+# Send Multiple Emails to Multiple Recipients
+
+import os
+import json
+from sendgrid import SendGridAPIClient
+from sendgrid.helpers.mail import Mail, From, To, Subject, PlainTextContent, HtmlContent, SendGridException, Substitution
+import time
+import datetime
+
+to_emails = [
+ To(email='ethomas@twilio.com',
+ name='Elmer Twilio',
+ substitutions={
+ Substitution('-name-', 'Elmer Twilio'),
+ Substitution('-github-', 'http://github.com/ethomas'),
+ },
+ subject=Subject('Override Global Subject')),
+ To(email='elmer.thomas@gmail.com',
+ name='Elmer Thomas',
+ substitutions={
+ Substitution('-name-', 'Elmer Thomas'),
+ Substitution('-github-', 'http://github.com/thinkingserious'),
+ })
+]
+ts = time.time()
+global_substitutions = Substitution('-time-', datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))
+message = Mail(from_email=From('help@twilio.com', 'Twilio SendGrid'),
+ to_emails=to_emails,
+ subject=Subject('Hi -name-'),
+ plain_text_content=PlainTextContent('Hello -name-, your github is -github-, email sent at -time-'),
+ html_content=HtmlContent('Hello -name-, your github is here email sent at -time-'),
+ global_substitutions=global_substitutions,
+ is_multiple=True)
+
+try:
+ print(json.dumps(message.get(), sort_keys=True, indent=4))
+ sendgrid_client = SendGridAPIClient(api_key=os.environ.get('SENDGRID_API_KEY'))
+ response = sendgrid_client.send(message=message)
+ print(response.status_code)
+ print(response.body)
+ print(response.headers)
+except SendGridException as e:
+ print(e.message)
+
+# Kitchen Sink - an example with all settings used
+
+import os
+import json
+from sendgrid import SendGridAPIClient
+from sendgrid.helpers.mail import (
+ Mail, From, To, Cc, Bcc, Subject, PlainTextContent,
+ HtmlContent, SendGridException, Substitution,
+ Header, CustomArg, SendAt, Content, MimeType, Attachment,
+ FileName, FileContent, FileType, Disposition, ContentId,
+ TemplateId, Section, ReplyTo, Category, BatchId, Asm,
+ GroupId, GroupsToDisplay, IpPoolName, MailSettings,
+ BccSettings, BccSettingsEmail, BypassListManagement,
+ FooterSettings, FooterText, FooterHtml, SandBoxMode,
+ SpamCheck, SpamThreshold, SpamUrl, TrackingSettings,
+ ClickTracking, SubscriptionTracking, SubscriptionText,
+ SubscriptionHtml, SubscriptionSubstitutionTag,
+ OpenTracking, OpenTrackingSubstitutionTag, Ganalytics,
+ UtmSource, UtmMedium, UtmTerm, UtmContent, UtmCampaign)
+import time
+import datetime
+
+message = Mail()
+
+# Define Personalizations
+
+message.to = To('elmer+test1@sendgrid.com', 'Example User1', p=0)
+message.to = [
+ To('elmer+test2@sendgrid.com', 'Example User2', p=0),
+ To('elmer+test3@sendgrid.com', 'Example User3', p=0)
+]
+
+message.cc = Cc('test4@example.com', 'Example User4', p=0)
+message.cc = [
+ Cc('test5@example.com', 'Example User5', p=0),
+ Cc('test6@example.com', 'Example User6', p=0)
+]
+
+message.bcc = Bcc('test7@example.com', 'Example User7', p=0)
+message.bcc = [
+ Bcc('test8@example.com', 'Example User8', p=0),
+ Bcc('test9@example.com', 'Example User9', p=0)
+]
+
+message.subject = Subject('Sending with SendGrid is Fun 0', p=0)
+
+message.header = Header('X-Test1', 'Test1', p=0)
+message.header = Header('X-Test2', 'Test2', p=0)
+message.header = [
+ Header('X-Test3', 'Test3', p=0),
+ Header('X-Test4', 'Test4', p=0)
+]
+
+message.substitution = Substitution('%name1%', 'Example Name 1', p=0)
+message.substitution = Substitution('%city1%', 'Example City 1', p=0)
+message.substitution = [
+ Substitution('%name2%', 'Example Name 2', p=0),
+ Substitution('%city2%', 'Example City 2', p=0)
+]
+
+message.custom_arg = CustomArg('marketing1', 'true', p=0)
+message.custom_arg = CustomArg('transactional1', 'false', p=0)
+message.custom_arg = [
+ CustomArg('marketing2', 'false', p=0),
+ CustomArg('transactional2', 'true', p=0)
+]
+
+message.send_at = SendAt(1461775051, p=0)
+
+message.to = To('test10@example.com', 'Example User10', p=1)
+message.to = [
+ To('test11@example.com', 'Example User11', p=1),
+ To('test12@example.com', 'Example User12', p=1)
+]
+
+message.cc = Cc('test13@example.com', 'Example User13', p=1)
+message.cc = [
+ Cc('test14@example.com', 'Example User14', p=1),
+ Cc('test15@example.com', 'Example User15', p=1)
+]
+
+message.bcc = Bcc('test16@example.com', 'Example User16', p=1)
+message.bcc = [
+ Bcc('test17@example.com', 'Example User17', p=1),
+ Bcc('test18@example.com', 'Example User18', p=1)
+]
+
+message.header = Header('X-Test5', 'Test5', p=1)
+message.header = Header('X-Test6', 'Test6', p=1)
+message.header = [
+ Header('X-Test7', 'Test7', p=1),
+ Header('X-Test8', 'Test8', p=1)
+]
+
+message.substitution = Substitution('%name3%', 'Example Name 3', p=1)
+message.substitution = Substitution('%city3%', 'Example City 3', p=1)
+message.substitution = [
+ Substitution('%name4%', 'Example Name 4', p=1),
+ Substitution('%city4%', 'Example City 4', p=1)
+]
+
+message.custom_arg = CustomArg('marketing3', 'true', p=1)
+message.custom_arg = CustomArg('transactional3', 'false', p=1)
+message.custom_arg = [
+ CustomArg('marketing4', 'false', p=1),
+ CustomArg('transactional4', 'true', p=1)
+]
+
+message.send_at = SendAt(1461775052, p=1)
+
+message.subject = Subject('Sending with SendGrid is Fun 1', p=1)
+
+# The values below this comment are global to entire message
+
+message.from_email = From('help@twilio.com', 'Twilio SendGrid')
+
+message.reply_to = ReplyTo('help_reply@twilio.com', 'Twilio SendGrid Reply')
+
+message.subject = Subject('Sending with SendGrid is Fun 2')
+
+message.content = Content(MimeType.text, 'and easy to do anywhere, even with Python')
+message.content = Content(MimeType.html, 'and easy to do anywhere, even with Python')
+message.content = [
+ Content('text/calendar', 'Party Time!!'),
+ Content('text/custom', 'Party Time 2!!')
+]
+
+message.attachment = Attachment(FileContent('base64 encoded content 1'),
+ FileType('application/pdf'),
+ FileName('balance_001.pdf'),
+ Disposition('attachment'),
+ ContentId('Content ID 1'))
+message.attachment = [
+ Attachment(FileContent('base64 encoded content 2'),
+ FileType('image/png'),
+ FileName('banner.png'),
+ Disposition('inline'),
+ ContentId('Content ID 2')),
+ Attachment(FileContent('base64 encoded content 3'),
+ FileType('image/png'),
+ FileName('banner2.png'),
+ Disposition('inline'),
+ ContentId('Content ID 3'))
+]
+
+message.template_id = TemplateId('13b8f94f-bcae-4ec6-b752-70d6cb59f932')
+
+message.section = Section('%section1%', 'Substitution for Section 1 Tag')
+message.section = [
+ Section('%section2%', 'Substitution for Section 2 Tag'),
+ Section('%section3%', 'Substitution for Section 3 Tag')
+]
+
+message.header = Header('X-Test9', 'Test9')
+message.header = Header('X-Test10', 'Test10')
+message.header = [
+ Header('X-Test11', 'Test11'),
+ Header('X-Test12', 'Test12')
+]
+
+message.category = Category('Category 1')
+message.category = Category('Category 2')
+message.category = [
+ Category('Category 1'),
+ Category('Category 2')
+]
+
+message.custom_arg = CustomArg('marketing5', 'false')
+message.custom_arg = CustomArg('transactional5', 'true')
+message.custom_arg = [
+ CustomArg('marketing6', 'true'),
+ CustomArg('transactional6', 'false')
+]
+
+message.send_at = SendAt(1461775053)
+
+message.batch_id = BatchId("HkJ5yLYULb7Rj8GKSx7u025ouWVlMgAi")
+
+message.asm = Asm(GroupId(1), GroupsToDisplay([1,2,3,4]))
+
+message.ip_pool_name = IpPoolName("IP Pool Name")
+
+mail_settings = MailSettings()
+mail_settings.bcc_settings = BccSettings(False, BccSettingsEmail("bcc@twilio.com"))
+mail_settings.bypass_list_management = BypassListManagement(False)
+mail_settings.footer_settings = FooterSettings(True, FooterText("w00t"), FooterHtml("You have successfully launched the server!
- Check out the documentation on how to use this software to utilize the SendGrid Inbound Parse webhook.
+ Check out the documentation on how to use this software to utilize the SendGrid Inbound Parse webhook.