How to send emails connecting to the SMTP server directly?
I do not want to use mail()
to send e-mail. I would like to connect to th开发者_开发技巧e SMTP server directly.
Is there a class to do this job?
SwiftMailer does this.
http://swiftmailer.org/
Zend_Mail can do this for you:
$tr = new Zend_Mail_Transport_Smtp('mail.example.com');
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$mail->addTo('studio@example.com', 'Test');
$mail->setFrom('studio@example.com', 'Test');
$mail->setSubject('Subject');
$mail->setBodyText('...Your message here...');
$mail->send();
You have a list of existing smtp classes here
精彩评论