Prev | Current Page 241 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

In Listing 9.2 we are setting up Zend_Mail to send
via SMTP using the authentication required by the service provider and through a secure connection.
Listing 9.2 Setting up Zend_Mail to use an SMTP connection
require_once 'Zend/Mail/Transport/Smtp.php';
$authDetails = array(
'ssl' => 'tls', A
'port' => 25, A
'auth' => 'login', B
'username' => 'myusername', B
'password' => 'mypassword' B
);
$transport = new Zend_Mail_Transport_Smtp( C
'mail.our-smtp-server.com', $authDetails C
);
Zend_Mail::setDefaultTransport($transport); D
A Optional settings for the secure transport layer
B Optional Authentication details for the SMTP server
C Server and authentication details passed to the constructor
D SMTP is set as the default transport method
Having setup Zend_Mail to use the SMTP connection we are ready to use it and since we mentioned
sending large volumes of email we??™ll start with sending multiple emails.
Sending multiple emails via SMTP
There are occasions when we may need to send several emails out in one go, such as for example when
sending a newsletter to multiple users. However, in the PHP manual the mail() function has the following note:
It is worth noting that the mail() function is not suitable for larger volumes of email in a loop.


Pages:
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
nocleg lodz Angry Birds projektowanie stron gdynia mameh.sporgit.pl Kalkulator kredytowy