You can directly integrate Zend's mail module with SendGrid to use our SMTP servers for outgoing messages.

require_once '$HOME/sendgrid/Zend/library/Zend/Mail.php';
require_once '/$HOME/sendgrid/Zend/library/Zend/Mail/Transport/Smtp.php';

$smtpServer = 'smtp.sendgrid.net';
$username = 'username';
$api_key = 'api_key';

$config = array('ssl' => 'tls',
'port' => '587',
'auth' => 'login',
'username' => $username,
'api_key' => $api_key);

$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);

$mail = new Zend_Mail();

$mail->setFrom('sendeexampexample@example.com', 'Some Sender');
$mail->addTo('email@example.com','Some Recipient');
$mail->setSubject('Test Subject');
$mail->setBodyText('This is the text of the mail using Zend.');


If you prefer a modular installation, then check out Jurian Sluiman's SlmMail project at GitHub.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the SendGrid tag on Stack Overflow.

Thank you for your feedback!

We are always striving to improve our documentation quality, and your feedback is valuable to us. Please select the reason(s) for your feedback or provide additional information about how we can improve:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

Step 1

Get link

Get a free personal referral link here

Step 2

Give $10

Your user signs up and upgrade using link

Step 3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more