Programmer's Reference Guide
| Encoding |
SMTP Authentication
Zend_Mail supports the use of SMTP Authentication, which
can be enabled be passing the 'auth' parameter to the configuration array in
the Zend_Mail_Transport_Smtp constructor. The available
built-in Authentication methods are PLAIN, LOGIN and CRAM-MD5 which all
expect a 'username' and 'password' value in the configuration array.
Example #1 Enabling authentication within Zend_Mail_Transport_Smtp
$config = array('auth' => 'login',
'username' => 'myusername',
'password' => 'password');
$transport = new Zend_Mail_Transport_Smtp('mail.server.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('sender@test.com', 'Some Sender');
$mail->addTo('recipient@test.com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);
Note: Authentication types
The authentication type is case-insensitive but has no punctuation. E.g. to use CRAM-MD5 you would pass 'auth' => 'crammd5' in theZend_Mail_Transport_Smtpconstructor.
| Encoding |
Select a Version
Languages Available
Components
Search the Manual
Navigation
- Programmer's Reference Guide
- Programmer's Reference Guide
- Zend_Mail
- Introduction
- Sending via SMTP
- Sending Multiple Mails per SMTP Connection
- Using Different Transports
- HTML E-Mail
- Attachments
- Adding Recipients
- Controlling the MIME Boundary
- Additional Headers
- Character Sets
- Encoding
- SMTP Authentication
- Securing SMTP Transport
- Reading Mail Messages
