首页 > 其他 > 详细

邮件发送

时间:2016-08-16 17:31:06      阅读:205      评论:0      收藏:0      [点我收藏+]

url:   http://swiftmailer.org

首先看 文档的技术分享部分

 1 require_once lib/swift_required.php;
 2 
 3 // Create the Transport
 4 $transport = Swift_SmtpTransport::newInstance(smtp.example.org, 25)
 5   ->setUsername(your username)
 6   ->setPassword(your password)
 7   ;
 8 
 9 /*
10 You could alternatively use a different transport such as Sendmail or Mail:
11 
12 // Sendmail
13 $transport = Swift_SendmailTransport::newInstance(‘/usr/sbin/sendmail -bs‘);
14 
15 // Mail
16 $transport = Swift_MailTransport::newInstance();
17 */
18 
19 // Create the Mailer using your created Transport
20 $mailer = Swift_Mailer::newInstance($transport);
21 
22 // Create a message
23 $message = Swift_Message::newInstance(Wonderful Subject)
24   ->setFrom(array(john@doe.com => John Doe))
25   ->setTo(array(receiver@domain.org, other@domain.org => A name))
26   ->setBody(Here is the message itself)
27   ;
28 
29 // Send the message
30 $result = $mailer->send($message);

基本就实现了发送,然后再看技术分享 可以实现纯文字,网页,图片附件等发送方式

问题 · 对方邮箱退回或者直接当做垃圾邮件发送失败 得不到提示,也就是不一定发送成功;但对同一邮箱每次内容不同的话(同内容可以加个随机码),qq接收还是可以的。

邮件发送

原文:http://www.cnblogs.com/lxdd/p/5777156.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!