Skip to contentSkip to navigationSkip to topbar
Rate this page:

Zend


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


_25
<?php
_25
require_once '$HOME/sendgrid/Zend/library/Zend/Mail.php';
_25
require_once '/$HOME/sendgrid/Zend/library/Zend/Mail/Transport/Smtp.php';
_25
_25
$smtpServer = 'smtp.sendgrid.net';
_25
$username = 'username';
_25
$api_key = 'api_key';
_25
_25
$config = array('ssl' => 'tls',
_25
'port' => '587',
_25
'auth' => 'login',
_25
'username' => $username,
_25
'api_key' => $api_key);
_25
_25
$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
_25
_25
$mail = new Zend_Mail();
_25
_25
$mail->setFrom('sendeexampexample@example.com', 'Some Sender');
_25
$mail->addTo('email@example.com','Some Recipient');
_25
$mail->setSubject('Test Subject');
_25
$mail->setBodyText('This is the text of the mail using Zend.');
_25
_25
$mail->send($transport);
_25
?>

If you prefer a modular installation, then check out Jurian Sluiman's SlmMail project at GitHub(link takes you to an external page).


Rate this page: