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.

See a mistake? Edit this page