"fatal error when trying to send email using swiftmailer and sendgrid" Code Answer

4

there could be a number of things causing this. the most likely one is that your server has connecting to external hosts turned off. other possibilities are that you're using an old version of php that has an openssl error or that you're being rate limited by something.

you should take a look at this question for details on the external host issue: send mails via sendgrid


on a separate note, you should use the sendgrid php library if you want to send emails using sendgrid. it addresses a whole bunch of subtle nuances with swift and sending in general. also, it gives you access to the http api in case you can't use smtp for whatever reason.

https://github.com/sendgrid/sendgrid-php

full disclosure: i work as a developer evangelist for sendgrid and work on the php library from time to time.

By Matthew R. on September 3 2022

Answers related to “fatal error when trying to send email using swiftmailer and sendgrid”

Only authorized users can answer the Search term. Please sign in first, or register a free account.