@@ -97,27 +97,27 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
9797 $ fromName = reset ($ fromArray );
9898 $ fromEmail = key ($ fromArray );
9999
100- $ mail = new SendGrid \Mail (); //Intentionally not using constructor arguments as they are tedious to work with
100+ $ mail = new SendGrid \Mail \ Mail (); //Intentionally not using constructor arguments as they are tedious to work with
101101
102102 // categories can be useful if you use them like tags to, for example, distinguish different applications.
103103 foreach ($ this ->sendGridCategories as $ category ) {
104104 $ mail ->addCategory ($ category );
105105 }
106106
107- $ mail ->setFrom (new SendGrid \Email ( $ fromName , $ fromEmail ));
107+ $ mail ->setFrom (new SendGrid \Mail \ From ( $ fromEmail , $ fromName ));
108108 $ mail ->setSubject ($ message ->getSubject ());
109109
110110 // extract content type from body to prevent multi-part content-type error
111111 $ finfo = new finfo (FILEINFO_MIME_TYPE );
112112 $ contentType = $ finfo ->buffer ($ message ->getBody ());
113- $ mail ->addContent (new SendGrid \Content ($ contentType , $ message ->getBody ()));
113+ $ mail ->addContent (new SendGrid \Mail \ Content ($ contentType , $ message ->getBody ()));
114114
115- $ personalization = new SendGrid \Personalization ();
115+ $ personalization = new SendGrid \Mail \ Personalization ();
116116
117117 // process TO
118118 if ($ toArr = $ message ->getTo ()) {
119119 foreach ($ toArr as $ email => $ name ) {
120- $ personalization ->addTo (new SendGrid \Email ( $ name , $ email ));
120+ $ personalization ->addTo (new SendGrid \Mail \ To ( $ email , $ name ));
121121 ++$ sent ;
122122 $ prepareFailedRecipients [] = $ email ;
123123 }
@@ -126,7 +126,7 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
126126 // process CC
127127 if ($ ccArr = $ message ->getCc ()) {
128128 foreach ($ ccArr as $ email => $ name ) {
129- $ personalization ->addCc (new SendGrid \Email ( $ name , $ email ));
129+ $ personalization ->addCc (new SendGrid \Mail \ Cc ( $ email , $ name ));
130130 ++$ sent ;
131131 $ prepareFailedRecipients [] = $ email ;
132132 }
@@ -135,7 +135,7 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
135135 // process BCC
136136 if ($ bccArr = $ message ->getBcc ()) {
137137 foreach ($ bccArr as $ email => $ name ) {
138- $ personalization ->addBcc (new SendGrid \Email ( $ name , $ email ));
138+ $ personalization ->addBcc (new SendGrid \Mail \ Bcc ( $ email , $ name ));
139139 ++$ sent ;
140140 $ prepareFailedRecipients [] = $ email ;
141141 }
@@ -145,7 +145,7 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
145145 if ($ attachments = $ message ->getChildren ()) {
146146 foreach ($ attachments as $ attachment ) {
147147 if ($ attachment instanceof Swift_Mime_Attachment) {
148- $ sAttachment = new SendGrid \Attachment ();
148+ $ sAttachment = new SendGrid \Mail \ Attachment ();
149149 $ sAttachment ->setContent (base64_encode ($ attachment ->getBody ()));
150150 $ sAttachment ->setType ($ attachment ->getContentType ());
151151 $ sAttachment ->setFilename ($ attachment ->getFilename ());
@@ -154,7 +154,7 @@ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = nul
154154 $ mail ->addAttachment ($ sAttachment );
155155 } elseif (in_array ($ attachment ->getContentType (), ['text/plain ' , 'text/html ' ])) {
156156 // add part if any is defined, to avoid error please set body as text and part as html
157- $ mail ->addContent (new SendGrid \Content ($ attachment ->getContentType (), $ attachment ->getBody ()));
157+ $ mail ->addContent (new SendGrid \Mail \ Content ($ attachment ->getContentType (), $ attachment ->getBody ()));
158158 }
159159 }
160160 }
0 commit comments