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!";
        }

    困难是老天给我们提高的机会,坚定不移勇敢地去攻克,不要退缩,加油!
  • 相关阅读:
    three.js_ "Failed to execute 'texImage2D' on 'WebGLRenderingContext': tainted canvases may not be loded."
    three.js为何如此奇妙
    npm install ERR! code E400/E404
    小程序_请求封装network
    css_input[checked]复选框去掉默认样式并添加新样式
    【CSS】凹槽的写法
    剑指Offer_编程题_6
    剑指Offer_编程题_5
    剑指Offer_编程题_4
    剑指Offer_编程题_3
  • 原文地址:https://www.cnblogs.com/merlini/p/3517754.html
Copyright © 2011-2022 走看看