• 邮件发送


    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接收还是可以的。

  • 相关阅读:
    2016多校赛1 A 期望 B SG博弈,状压 D 倍增,二分
    POWOJ 1739: 魔术球问题 DAG最小路径覆盖转最大流
    Codeforces 743D 树形dp
    线性规划与网络流24题 索引
    WangEditor富文本编辑器的简单使用,并将文本数据发往后台
    SSRF
    关于Blind XXE
    blind xxe攻击
    linux awk命令详解
    kali
  • 原文地址:https://www.cnblogs.com/lxdd/p/5777156.html
Copyright © 2020-2023  润新知