@@ -10,7 +10,7 @@ import sendgrid
1010from sendgrid.helpers.mail import Mail, From, To, Subject, PlainTextContent, HtmlContent
1111
1212msg = Mail(from_email = From(' from@example.com' , ' From Name' ),
13- to_email = To(' to@example.com' , ' To Name' ),
13+ to_emails = To(' to@example.com' , ' To Name' ),
1414 subject = Subject(' Sending with SendGrid is Fun' ),
1515 plain_text_content = PlainTextContent(' and easy to do anywhere, even with Python' ),
1616 html_content = HtmlContent(' <strong>and easy to do anywhere, even with Python</strong>' ))
@@ -38,7 +38,7 @@ to_emails = [
3838 To(' to1@example.com' , ' To Name 1' )
3939]
4040msg = Mail(from_email = From(' from@example.com' , ' From Name' ),
41- to_emails = tos ,
41+ to_emails = to_emails ,
4242 subject = Subject(' Sending with SendGrid is Fun' ),
4343 plain_text_content = PlainTextContent(' and easy to do anywhere, even with Python' ),
4444 html_content = HtmlContent(' <strong>and easy to do anywhere, even with Python</strong>' ))
@@ -113,40 +113,40 @@ msg = Mail(from_email=From('from@example.com', 'From Name'),
113113# For a detailed description of each of these settings, please see the [documentation](https://sendgrid.com/docs/API_Reference/api_v3.html).
114114
115115msg.to = To(' test1@example.com' , ' Example User1' )
116- msg.tos = [
116+ msg.to = [
117117 To(' test2@example.com' , ' Example User2' ),
118118 To(' test3@example.com' , ' Example User3' )
119119]
120120
121121msg.cc = Cc(' test4@example.com' , ' Example User4' )
122- msg.ccs = [
122+ msg.cc = [
123123 Cc(' test5@example.com' , ' Example User5' ),
124124 Cc(' test6@example.com' , ' Example User6' )
125125]
126126
127127msg.bcc = Bcc(' test7@example.com' , ' Example User7' )
128- msg.bccs = [
128+ msg.bcc = [
129129 Bcc(' test8@example.com' , ' Example User8' ),
130130 Bcc(' test9@example.com' , ' Example User9' )
131131]
132132
133133msg.header = Header(' X-Test1' , ' Test1' )
134134msg.header = Header(' X-Test2' , ' Test2' )
135- msg.headers = [
135+ msg.header = [
136136 Header(' X-Test3' , ' Test3' ),
137137 Header(' X-Test4' , ' Test4' )
138138]
139139
140140msg.substitution = Substitution(' %name1%' , ' Example Name 1' )
141141msg.substitution = Substitution(' %c ity1%' , ' Denver' )
142- msg.substitutions = [
142+ msg.substitution = [
143143 Substitution(' %name2%' , ' Example Name 2' ),
144144 Substitution(' %c ity2%' , ' Orange' )
145145]
146146
147147msg.custom_arg = CustomArg(' marketing1' , ' false' )
148148msg.custom_arg = CustomArg(' transactional1' , ' true' )
149- msg.custom_args = [
149+ msg.custom_arg = [
150150 CustomArg(' marketing2' , ' true' ),
151151 CustomArg(' transactional2' , ' false' )
152152]
@@ -156,19 +156,19 @@ msg.send_at = SendAt(1461775051)
156156# If you need to add more [Personalizations](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html), here is an example of adding another Personalization by passing in a personalization index.
157157
158158msg.to = To(' test10@example.com' , ' Example User10' , p = p = 1 )
159- msg.tos = [
159+ msg.to = [
160160 To(' test11@example.com' , ' Example User11' , p = 1 ),
161161 To(' test12@example.com' , ' Example User12' , p = 1 )
162162]
163163
164164msg.cc = Cc(' test13@example.com' , ' Example User13' , p = 1 )
165- msg.ccs = [
165+ msg.cc = [
166166 Cc(' test14@example.com' , ' Example User14' , p = 1 ),
167167 Cc(' test15@example.com' , ' Example User15' , p = 1 )
168168]
169169
170170msg.bcc = Bcc(' test16@example.com' , ' Example User16' , p = 1 )
171- msg.bccs = [
171+ msg.bcc = [
172172 Bcc(' test17@example.com' , ' Example User17' , p = 1 ),
173173 Bcc(' test18@example.com' , ' Example User18' , p = 1 )
174174]
@@ -182,14 +182,14 @@ msg.headers = [
182182
183183msg.substitution = Substitution(' %name3%' , ' Example Name 3' , p = 1 )
184184msg.substitution = Substitution(' %c ity3%' , ' Redwood City' , p = 1 )
185- msg.substitutions = [
185+ msg.substitution = [
186186 Substitution(' %name4%' , ' Example Name 4' , p = 1 ),
187187 Substitution(' %c ity4%' , ' London' , p = 1 )
188188]
189189
190190msg.custom_arg = CustomArg(' marketing3' , ' true' , p = 1 )
191191msg.custom_arg = CustomArg(' transactional3' , ' false' , p = 1 )
192- msg.custom_args = [
192+ msg.custom_arg = [
193193 CustomArg(' marketing4' , ' false' , p = 1 ),
194194 CustomArg(' transactional4' : ' true' , p = 1 )
195195]
@@ -202,7 +202,7 @@ msg.global_subject = Subject('Sending with SendGrid is Fun')
202202
203203msg.content = Content(MimeType.Text, ' and easy to do anywhere, even with Python' )
204204msg.content = Content(MimeType.Html, ' <strong>and easy to do anywhere, even with Python</strong>' )
205- msg.contents = [
205+ msg.content = [
206206 Content(' text/calendar' , ' Party Time!!' ),
207207 Content(' text/custom' , ' Party Time 2!!' )
208208]
@@ -212,7 +212,7 @@ msg.attachment = Attachment(FileName('balance_001.pdf'),
212212 Type(' application/pdf' ),
213213 Disposition(' attachment' ),
214214 Name(' Balance Sheet' ))
215- msg.attachments = [
215+ msg.attachment = [
216216 Attachment(FileName(' banner.png' ),
217217 File(' base64 encoded content' ),
218218 Type(' image/png' ),
@@ -234,7 +234,7 @@ msg.global_headers = [
234234]
235235
236236msg.section = Section(' %s ection1%' , ' Substitution for Section 1 Tag' )
237- msg.sections = [
237+ msg.section = [
238238 Section(' %s ection2%' , ' Substitution for Section 2 Tag' ),
239239 Section(' %s ection3%' : ' Substitution for Section 3 Tag' )
240240]
@@ -258,7 +258,7 @@ import sendgrid
258258from sendgrid.helpers.mail import Mail, From, To, Subject, PlainTextContent, HtmlContent, Attachment
259259
260260msg = Mail(from_email = From(' from@example.com' , ' From Name' ),
261- to_email = To(' to@example.com' , ' To Name' ),
261+ to_emails = To(' to@example.com' , ' To Name' ),
262262 subject = Subject(' Sending with SendGrid is Fun' ),
263263 plain_text_content = PlainTextContent(' and easy to do anywhere, even with Python' ),
264264 html_content = HtmlContent(' <strong>and easy to do anywhere, even with Python</strong>' ))
@@ -321,11 +321,11 @@ import sendgrid
321321from sendgrid.helpers.mail import Mail, From, To, Subject, PlainTextContent, HtmlContent, Attachment
322322
323323msg = Mail(from_email = From(' from@example.com' , ' From Name' ),
324- to_email = To(' to@example.com' , ' To Name' ),
324+ to_emails = To(' to@example.com' , ' To Name' ),
325325 subject = Subject(' Sending with SendGrid is Fun' ),
326326 plain_text_content = PlainTextContent(' and easy to do anywhere, even with Python' ),
327327 html_content = HtmlContent(' <strong>and easy to do anywhere, even with Python</strong>' ))
328- msg.substitutions = = [
328+ msg.substitution = [
329329 Substitution(' -name-' , ' Example User' ),
330330 Substitution(' -city-' , ' Denver' )
331331]
338338 print (response.headers)
339339except Exception as e:
340340 print (e.read())
341- ```
341+ ```
0 commit comments