Programmer's Reference Guide
| Sending via SMTP |
Sending Multiple Mails per SMTP Connection
By default, an SMTP connection is established for every e-mail that is sent. If you want to send
multiple e-mails through one SMTP connection, you can handle the connect() yourself. If the
transport has already established a connection before send() is called, it will be used
and will not be closed:
Example #1 Sending Multiple Mails per SMTP Connection
<?php
require_once 'Zend/Mail.php';
$mail = new Zend_Mail();
// build message...
require_once 'Zend/Mail/Transport/Smtp.php';
$tr = new Zend_Mail_Transport_Smtp('mail.example.com');
Zend_Mail::setDefaultTransport($tr);
$tr->connect();
for ($i = 0; $i < 5; $i++) {
$mail->send();
}
$tr->disconnect();
| Sending via SMTP |
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
