Skip to contentSkip to navigationSkip to topbar

Zend


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

1
<?php
2
require_once '$HOME/sendgrid/Zend/library/Zend/Mail.php';
3
require_once '/$HOME/sendgrid/Zend/library/Zend/Mail/Transport/Smtp.php';
4
5
$smtpServer = 'smtp.sendgrid.net';
6
$username = 'username';
7
$api_key = 'api_key';
8
9
$config = array('ssl' => 'tls',
10
'port' => '587',
11
'auth' => 'login',
12
'username' => $username,
13
'api_key' => $api_key);
14
15
$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
16
17
$mail = new Zend_Mail();
18
19
$mail->setFrom('sendeexampexample@example.com', 'Some Sender');
20
$mail->addTo('email@example.com','Some Recipient');
21
$mail->setSubject('Test Subject');
22
$mail->setBodyText('This is the text of the mail using Zend.');
23
24
$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).

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.