Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit c29cfcc

Browse files
Updated example data
1 parent b1f5701 commit c29cfcc

4 files changed

Lines changed: 48 additions & 48 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ source ./sendgrid.env
4343
import sendgrid
4444
from sendgrid.helpers.mail import *
4545

46-
from_email = Email("dx@sendgrid.com")
46+
from_email = Email("test@example.com")
4747
subject = "Hello World from the SendGrid Python Library"
48-
to_email = Email("elmer.thomas@sendgrid.com")
48+
to_email = Email("test@example.com")
4949
content = Content("text/plain", "some text here")
5050
mail = Mail(from_email, subject, to_email, content)
5151
response = sg.client.mail.send.beta.post(request_body=mail.get())

examples/helpers/mail/mail_example.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,52 @@
88

99
def build_hello_email():
1010
"""Minimum required to send an email"""
11-
from_email = Email("dx@sendgrid.com")
11+
from_email = Email("test@example.com")
1212
subject = "Hello World from the SendGrid Python Library"
13-
to_email = Email("elmer.thomas@sendgrid.com")
13+
to_email = Email("test@example.com")
1414
content = Content("text/plain", "some text here")
1515
mail = Mail(from_email, subject, to_email, content)
16-
mail.personalizations[0].add_to(Email("elmer.thomas+add_second_email@sendgrid.com"))
16+
mail.personalizations[0].add_to(Email("test@example.com"))
1717

1818
return mail.get()
1919

2020
def build_kitchen_sink():
2121
"""All settings set"""
2222
mail = Mail()
2323

24-
mail.set_from(Email("dx@sendgrid.com", "Elmer Thomas"))
24+
mail.set_from(Email("test@example.com", "Example User"))
2525

2626
mail.set_subject("Hello World from the SendGrid Python Library")
2727

2828
personalization = Personalization()
29-
personalization.add_to(Email("elmer.thomas@sendgrid.com", "Elmer Thomas"))
30-
personalization.add_to(Email("elmer.thomas@gmail.com", "Elmer Thomas Alias"))
31-
personalization.add_cc(Email("matt.bernier@sendgrid.com", "Matt Bernier"))
32-
personalization.add_cc(Email("eric.shallock@sendgrid.com", "Eric Shallock"))
33-
personalization.add_bcc(Email("matt.bernier+dx@sendgrid.com"))
34-
personalization.add_bcc(Email("eric.shallock+dx@sendgrid.com"))
29+
personalization.add_to(Email("test@example.com", "Example User"))
30+
personalization.add_to(Email("test@example.com", "Example User"))
31+
personalization.add_cc(Email("test@example.com", "Example User"))
32+
personalization.add_cc(Email("test@example.com", "Example User"))
33+
personalization.add_bcc(Email("test@example.com"))
34+
personalization.add_bcc(Email("test@example.com"))
3535
personalization.set_subject("Hello World from the Personalized SendGrid Python Library")
3636
personalization.add_header(Header("X-Test", "test"))
3737
personalization.add_header(Header("X-Mock", "true"))
38-
personalization.add_substitution(Substitution("%name%", "Tim"))
39-
personalization.add_substitution(Substitution("%city%", "Riverside"))
38+
personalization.add_substitution(Substitution("%name%", "Example User"))
39+
personalization.add_substitution(Substitution("%city%", "Denver"))
4040
personalization.add_custom_arg(CustomArg("user_id", "343"))
4141
personalization.add_custom_arg(CustomArg("type", "marketing"))
4242
personalization.set_send_at(1443636843)
4343
mail.add_personalization(personalization)
4444

4545
personalization2 = Personalization()
46-
personalization2.add_to(Email("elmer.thomas@sendgrid.com", "Elmer Thomas"))
47-
personalization2.add_to(Email("elmer.thomas@gmail.com", "Elmer Thomas Alias"))
48-
personalization2.add_cc(Email("matt.bernier@sendgrid.com", "Matt Bernier"))
49-
personalization2.add_cc(Email("eric.shallock@sendgrid.com", "Eric Shallock"))
50-
personalization2.add_bcc(Email("matt.bernier+dx@sendgrid.com"))
51-
personalization2.add_bcc(Email("eric.shallock+dx@sendgrid.com"))
46+
personalization2.add_to(Email("test@example.com", "Example User"))
47+
personalization2.add_to(Email("test@example.com", "Example User"))
48+
personalization2.add_cc(Email("test@example.com", "Example User"))
49+
personalization2.add_cc(Email("test@example.com", "Eric Shallock"))
50+
personalization2.add_bcc(Email("test@example.com"))
51+
personalization2.add_bcc(Email("test@example.com"))
5252
personalization2.set_subject("Hello World from the Personalized SendGrid Python Library")
5353
personalization2.add_header(Header("X-Test", "test"))
5454
personalization2.add_header(Header("X-Mock", "true"))
55-
personalization2.add_substitution(Substitution("%name%", "Tim"))
56-
personalization2.add_substitution(Substitution("%city%", "Riverside"))
55+
personalization2.add_substitution(Substitution("%name%", "Example User"))
56+
personalization2.add_substitution(Substitution("%city%", "Denver"))
5757
personalization2.add_custom_arg(CustomArg("user_id", "343"))
5858
personalization2.add_custom_arg(CustomArg("type", "marketing"))
5959
personalization2.set_send_at(1443636843)
@@ -102,7 +102,7 @@ def build_kitchen_sink():
102102
mail.set_ip_pool_name("24")
103103

104104
mail_settings = MailSettings()
105-
mail_settings.set_bcc_settings(BCCSettings(True, Email("dx+reply@sendgrid.com")))
105+
mail_settings.set_bcc_settings(BCCSettings(True, Email("test@example.com")))
106106
mail_settings.set_bypass_list_management(BypassListManagement(True))
107107
mail_settings.set_footer_settings(FooterSettings(True, "Footer Text", "<html><body>Footer Text</body></html>"))
108108
mail_settings.set_sandbox_mode(SandBoxMode(True))
@@ -116,7 +116,7 @@ def build_kitchen_sink():
116116
tracking_settings.set_ganalytics(Ganalytics(True, "some source", "some medium", "some term", "some_content", "some_campaign"))
117117
mail.set_tracking_settings(tracking_settings)
118118

119-
mail.set_reply_to(Email("dx+reply@sendgrid.com"))
119+
mail.set_reply_to(Email("test@example.com"))
120120

121121
return mail.get()
122122

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
long_description = open('README.txt').read()
1212

1313
def getRequires():
14-
deps = ['smtpapi==0.3.1', 'python_http_client==1.2.3']
14+
deps = ['python_http_client==1.2.3']
1515
if sys.version_info < (2, 7):
1616
deps.append('unittest2')
1717
elif (3, 0) <= sys.version_info < (3, 2):

test/test_mail.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,58 +16,58 @@ def test_helloEmail(self):
1616
"""Minimum required to send an email"""
1717
mail = Mail()
1818

19-
mail.set_from(Email("dx@sendgrid.com"))
19+
mail.set_from(Email("test@example.com"))
2020

2121
mail.set_subject("Hello World from the SendGrid Python Library")
2222

2323
personalization = Personalization()
24-
personalization.add_to(Email("elmer.thomas@sendgrid.com"))
24+
personalization.add_to(Email("test@example.com"))
2525
mail.add_personalization(personalization)
2626

2727
mail.add_content(Content("text/plain", "some text here"))
2828
mail.add_content(Content("text/html", "<html><body>some text here</body></html>"))
2929

30-
self.assertEqual(json.dumps(mail.get(), sort_keys=True), '{"content": [{"type": "text/plain", "value": "some text here"}, {"type": "text/html", "value": "<html><body>some text here</body></html>"}], "from": {"email": "dx@sendgrid.com"}, "personalizations": [{"to": [{"email": "elmer.thomas@sendgrid.com"}]}], "subject": "Hello World from the SendGrid Python Library"}')
30+
self.assertEqual(json.dumps(mail.get(), sort_keys=True), '{"content": [{"type": "text/plain", "value": "some text here"}, {"type": "text/html", "value": "<html><body>some text here</body></html>"}], "from": {"email": "test@example.com"}, "personalizations": [{"to": [{"email": "test@example.com"}]}], "subject": "Hello World from the SendGrid Python Library"}')
3131

3232
def test_kitchenSink(self):
3333
self.maxDiff = None
3434

3535
"""All settings set"""
3636
mail = Mail()
3737

38-
mail.set_from(Email("dx@sendgrid.com", "Elmer Thomas"))
38+
mail.set_from(Email("test@example.com", "Example User"))
3939

4040
mail.set_subject("Hello World from the SendGrid Python Library")
4141

4242
personalization = Personalization()
43-
personalization.add_to(Email("elmer.thomas@sendgrid.com", "Elmer Thomas"))
44-
personalization.add_to(Email("elmer.thomas@gmail.com", "Elmer Thomas Alias"))
45-
personalization.add_cc(Email("matt.bernier@sendgrid.com", "Matt Bernier"))
46-
personalization.add_cc(Email("eric.shallock@sendgrid.com", "Eric Shallock"))
47-
personalization.add_bcc(Email("matt.bernier+dx@sendgrid.com"))
48-
personalization.add_bcc(Email("eric.shallock+dx@sendgrid.com"))
43+
personalization.add_to(Email("test@example.com", "Example User"))
44+
personalization.add_to(Email("test@example.com", "Example User"))
45+
personalization.add_cc(Email("test@example.com", "Example User"))
46+
personalization.add_cc(Email("test@example.com", "Example User"))
47+
personalization.add_bcc(Email("test@example.com"))
48+
personalization.add_bcc(Email("test@example.com"))
4949
personalization.set_subject("Hello World from the Personalized SendGrid Python Library")
5050
personalization.add_header(Header("X-Test", "test"))
5151
personalization.add_header(Header("X-Mock", "true"))
52-
personalization.add_substitution(Substitution("%name%", "Tim"))
53-
personalization.add_substitution(Substitution("%city%", "Riverside"))
52+
personalization.add_substitution(Substitution("%name%", "Example User"))
53+
personalization.add_substitution(Substitution("%city%", "Denver"))
5454
personalization.add_custom_arg(CustomArg("user_id", "343"))
5555
personalization.add_custom_arg(CustomArg("type", "marketing"))
5656
personalization.set_send_at(1443636843)
5757
mail.add_personalization(personalization)
5858

5959
personalization2 = Personalization()
60-
personalization2.add_to(Email("elmer.thomas@sendgrid.com", "Elmer Thomas"))
61-
personalization2.add_to(Email("elmer.thomas@gmail.com", "Elmer Thomas Alias"))
62-
personalization2.add_cc(Email("matt.bernier@sendgrid.com", "Matt Bernier"))
63-
personalization2.add_cc(Email("eric.shallock@sendgrid.com", "Eric Shallock"))
64-
personalization2.add_bcc(Email("matt.bernier+dx@sendgrid.com"))
65-
personalization2.add_bcc(Email("eric.shallock+dx@sendgrid.com"))
60+
personalization2.add_to(Email("test@example.com", "Example User"))
61+
personalization2.add_to(Email("test@example.com", "Example User"))
62+
personalization2.add_cc(Email("test@example.com", "Example User"))
63+
personalization2.add_cc(Email("test@example.com", "Example User"))
64+
personalization2.add_bcc(Email("test@example.com"))
65+
personalization2.add_bcc(Email("test@example.com"))
6666
personalization2.set_subject("Hello World from the Personalized SendGrid Python Library")
6767
personalization2.add_header(Header("X-Test", "test"))
6868
personalization2.add_header(Header("X-Mock", "true"))
69-
personalization2.add_substitution(Substitution("%name%", "Tim"))
70-
personalization2.add_substitution(Substitution("%city%", "Riverside"))
69+
personalization2.add_substitution(Substitution("%name%", "Example User"))
70+
personalization2.add_substitution(Substitution("%city%", "Denver"))
7171
personalization2.add_custom_arg(CustomArg("user_id", "343"))
7272
personalization2.add_custom_arg(CustomArg("type", "marketing"))
7373
personalization2.set_send_at(1443636843)
@@ -115,7 +115,7 @@ def test_kitchenSink(self):
115115
mail.set_ip_pool_name("24")
116116

117117
mail_settings = MailSettings()
118-
mail_settings.set_bcc_settings(BCCSettings(True, Email("dx+reply@sendgrid.com")))
118+
mail_settings.set_bcc_settings(BCCSettings(True, Email("test@example.com")))
119119
mail_settings.set_bypass_list_management(BypassListManagement(True))
120120
mail_settings.set_footer_settings(FooterSettings(True, "Footer Text", "<html><body>Footer Text</body></html>"))
121121
mail_settings.set_sandbox_mode(SandBoxMode(True))
@@ -129,6 +129,6 @@ def test_kitchenSink(self):
129129
tracking_settings.set_ganalytics(Ganalytics(True, "some source", "some medium", "some term", "some content", "some campaign"))
130130
mail.set_tracking_settings(tracking_settings)
131131

132-
mail.set_reply_to(Email("dx+reply@sendgrid.com"))
132+
mail.set_reply_to(Email("test@example.com"))
133133

134-
self.assertEqual(json.dumps(mail.get(), sort_keys=True), '{"asm": {"group_id": 99, "groups_to_display": [4, 5, 6, 7, 8]}, "attachments": [{"content": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12", "content_id": "Balance Sheet", "disposition": "attachment", "filename": "balance_001.pdf", "type": "application/pdf"}, {"content": "BwdW", "content_id": "Banner", "disposition": "inline", "filename": "banner.png", "type": "image/png"}], "batch_id": "sendgrid_batch_id", "categories": ["May", "2016"], "content": [{"type": "text/plain", "value": "some text here"}, {"type": "text/html", "value": "<html><body>some text here</body></html>"}], "custom_args": {"campaign": "welcome", "weekday": "morning"}, "from": {"email": "dx@sendgrid.com", "name": "Elmer Thomas"}, "headers": {"X-Test1": "test1", "X-Test3": "test2"}, "ip_pool_name": "24", "mail_settings": {"bcc": {"email": "dx+reply@sendgrid.com", "enable": true}, "bypass_list_management": {"enable": true}, "footer": {"enable": true, "html": "<html><body>Footer Text</body></html>", "text": "Footer Text"}, "sandbox_mode": {"enable": true}, "spam_check": {"enable": true, "post_to_url": "https://spamcatcher.sendgrid.com", "threshold": 1}}, "personalizations": [{"bcc": [{"email": "matt.bernier+dx@sendgrid.com"}, {"email": "eric.shallock+dx@sendgrid.com"}], "cc": [{"email": "matt.bernier@sendgrid.com", "name": "Matt Bernier"}, {"email": "eric.shallock@sendgrid.com", "name": "Eric Shallock"}], "custom_args": {"type": "marketing", "user_id": "343"}, "headers": {"X-Mock": "true", "X-Test": "test"}, "send_at": 1443636843, "subject": "Hello World from the Personalized SendGrid Python Library", "substitutions": {"%city%": "Riverside", "%name%": "Tim"}, "to": [{"email": "elmer.thomas@sendgrid.com", "name": "Elmer Thomas"}, {"email": "elmer.thomas@gmail.com", "name": "Elmer Thomas Alias"}]}, {"bcc": [{"email": "matt.bernier+dx@sendgrid.com"}, {"email": "eric.shallock+dx@sendgrid.com"}], "cc": [{"email": "matt.bernier@sendgrid.com", "name": "Matt Bernier"}, {"email": "eric.shallock@sendgrid.com", "name": "Eric Shallock"}], "custom_args": {"type": "marketing", "user_id": "343"}, "headers": {"X-Mock": "true", "X-Test": "test"}, "send_at": 1443636843, "subject": "Hello World from the Personalized SendGrid Python Library", "substitutions": {"%city%": "Riverside", "%name%": "Tim"}, "to": [{"email": "elmer.thomas@sendgrid.com", "name": "Elmer Thomas"}, {"email": "elmer.thomas@gmail.com", "name": "Elmer Thomas Alias"}]}], "reply_to": {"email": "dx+reply@sendgrid.com"}, "sections": {"%section1%": "Substitution Text for Section 1", "%section2%": "Substitution Text for Section 2"}, "send_at": 1443636842, "subject": "Hello World from the SendGrid Python Library", "template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932", "tracking_settings": {"click_tracking": {"enable": true, "enable_text": true}, "ganalytics": {"enable": true, "utm_campaign": "some campaign", "utm_content": "some content", "utm_medium": "some medium", "utm_source": "some source", "utm_term": "some term"}, "open_tracking": {"enable": true, "substitution_tag": "Optional tag to replace with the open image in the body of the message"}, "subscription_tracking": {"enable": true, "html": "<html><body>html to insert into the text/html portion of the message</body></html>", "substitution_tag": "Optional tag to replace with the open image in the body of the message", "text": "text to insert into the text/plain portion of the message"}}}')
134+
self.assertEqual(json.dumps(mail.get(), sort_keys=True), '{"asm": {"group_id": 99, "groups_to_display": [4, 5, 6, 7, 8]}, "attachments": [{"content": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12", "content_id": "Balance Sheet", "disposition": "attachment", "filename": "balance_001.pdf", "type": "application/pdf"}, {"content": "BwdW", "content_id": "Banner", "disposition": "inline", "filename": "banner.png", "type": "image/png"}], "batch_id": "sendgrid_batch_id", "categories": ["May", "2016"], "content": [{"type": "text/plain", "value": "some text here"}, {"type": "text/html", "value": "<html><body>some text here</body></html>"}], "custom_args": {"campaign": "welcome", "weekday": "morning"}, "from": {"email": "test@example.com", "name": "Example User"}, "headers": {"X-Test1": "test1", "X-Test3": "test2"}, "ip_pool_name": "24", "mail_settings": {"bcc": {"email": "test@example.com", "enable": true}, "bypass_list_management": {"enable": true}, "footer": {"enable": true, "html": "<html><body>Footer Text</body></html>", "text": "Footer Text"}, "sandbox_mode": {"enable": true}, "spam_check": {"enable": true, "post_to_url": "https://spamcatcher.sendgrid.com", "threshold": 1}}, "personalizations": [{"bcc": [{"email": "test@example.com"}, {"email": "test@example.com"}], "cc": [{"email": "test@example.com", "name": "Example User"}, {"email": "test@example.com", "name": "Example User"}], "custom_args": {"type": "marketing", "user_id": "343"}, "headers": {"X-Mock": "true", "X-Test": "test"}, "send_at": 1443636843, "subject": "Hello World from the Personalized SendGrid Python Library", "substitutions": {"%city%": "Denver", "%name%": "Example User"}, "to": [{"email": "test@example.com", "name": "Example User"}, {"email": "test@example.com", "name": "Example User"}]}, {"bcc": [{"email": "test@example.com"}, {"email": "test@example.com"}], "cc": [{"email": "test@example.com", "name": "Example User"}, {"email": "test@example.com", "name": "Example User"}], "custom_args": {"type": "marketing", "user_id": "343"}, "headers": {"X-Mock": "true", "X-Test": "test"}, "send_at": 1443636843, "subject": "Hello World from the Personalized SendGrid Python Library", "substitutions": {"%city%": "Denver", "%name%": "Example User"}, "to": [{"email": "test@example.com", "name": "Example User"}, {"email": "test@example.com", "name": "Example User"}]}], "reply_to": {"email": "test@example.com"}, "sections": {"%section1%": "Substitution Text for Section 1", "%section2%": "Substitution Text for Section 2"}, "send_at": 1443636842, "subject": "Hello World from the SendGrid Python Library", "template_id": "13b8f94f-bcae-4ec6-b752-70d6cb59f932", "tracking_settings": {"click_tracking": {"enable": true, "enable_text": true}, "ganalytics": {"enable": true, "utm_campaign": "some campaign", "utm_content": "some content", "utm_medium": "some medium", "utm_source": "some source", "utm_term": "some term"}, "open_tracking": {"enable": true, "substitution_tag": "Optional tag to replace with the open image in the body of the message"}, "subscription_tracking": {"enable": true, "html": "<html><body>html to insert into the text/html portion of the message</body></html>", "substitution_tag": "Optional tag to replace with the open image in the body of the message", "text": "text to insert into the text/plain portion of the message"}}}')

0 commit comments

Comments
 (0)