zoukankan      html  css  js  c++  java
  • 【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!";
        }

    困难是老天给我们提高的机会,坚定不移勇敢地去攻克,不要退缩,加油!
  • 相关阅读:
    app分析报告试验
    NABCD模式试验
    课堂练习
    学生管理系统测试计划及测试矩阵
    图书管理系统活动,时序图
    图书借阅测试用例UML图
    风险分析
    需求规格说明说
    PM的定义跟功能说明模块
    需求分析-NABCD
  • 原文地址:https://www.cnblogs.com/merlini/p/3517754.html
Copyright © 2011-2022 走看看