开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜