• 【phpmailer】


     $mail = new PHPMailer();
        $body = file_get_contents('contents.html'); //$body = $_POST['body'];
        $body = eregi_replace("[]",'',$body);
        $mail->IsSMTP(); // telling the class to use SMTP
        $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
        // 1 = errors and messages
        // 2 = messages only
        $mail->SMTPAuth = true; // enable SMTP authentication
        $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
        $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server or ssl://smtp.gmail.com
        $mail->Port = 465; // set the SMTP port for the GMAIL server
        $mail->Username = "yourusername@gmail.com"; // GMAIL username
        $mail->Password = "yourpassword"; // GMAIL password
        $mail->SetFrom('name@yourdomain.com', 'First Last');
        $mail->AddReplyTo("name@yourdomain.com","First Last");
        $mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
        $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
        $mail->MsgHTML($body);
        $address = "whoto@otherdomain.com";
        $mail->AddAddress($address, "John Doe");
        $mail->AddAttachment("images/phpmailer.gif"); // attachment
        $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
        if(!$mail->Send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
        } else {
        echo "Message sent!";
        }

    困难是老天给我们提高的机会,坚定不移勇敢地去攻克,不要退缩,加油!
  • 相关阅读:
    squid开多端口代理的心得
    用ssh跑pppd(最简单的linuxvpn)
    Asterisk1.2编译与安装
    E1 CE1 PRI BRI T1 的区别
    asterisk卡常见问题(收集整理)
    CCProxy+Eborder开透明代理详细设置(附图文)
    iptables+NAT+squid 透明代理上网实现方案
    asterisk积累命令
    MySQL Cluster的常见问题
    如何配置Silverlight4开发环境
  • 原文地址:https://www.cnblogs.com/merlini/p/3517754.html
Copyright © 2020-2023  润新知