phpmailer發送郵件,可以帶附件_PHP教程

來源:互聯網
上載者:User
執行個體 require_once ('PHPMailer/class.phpmailer.php'); //引入phpmailer檔案require_once ('PHPMailer/class.smtp.php'); $mail=new PHPMailer(); //執行個體化phpmailer類 $mail->IsSMTP(); $mail->CharSet='UTF-8'; $mail->AddAddress(123@163.com); //收件者郵箱 $mail->Body=$content; //發件內容 $mail->From=from@163.com; //寄件者郵箱from@163.com $mail->FromName="zjsupport"; //寄件者的名字 $mail->Subject="title"; //郵件標題 $mail->Host="smtp.163.com"; //smtp伺服器 $mail->SMTPAuth=true; //開啟smtp服務 $mail->IsHTML(true); //發送附件 $mail->AddAttachment(path,name); //path是附件的儲存路徑 name是附件的名字 //可以上傳多個附件,一模一樣複製 $mail->AddAttachment(path,name); 代碼就行 $mail->Username="from@163.com ";//寄件者郵箱 $mail->Password="123456";//寄件者郵箱密碼 if($mail->Send()){ //判斷郵件是否發送成功 echo "success"; }else{ $email_error=$email_error.";".$val; //若不成功將發送失敗的郵箱存入字元竄 } if($email_error==""){ echo "email_success"; }else{ echo $email_error; }

http://www.bkjia.com/PHPjc/477115.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/477115.htmlTechArticle執行個體 require_once (PHPMailer/class.phpmailer.php); //引入phpmailer檔案 require_once (PHPMailer/class.smtp.php); $mail=new PHPMailer(); //執行個體化phpmailer類 $mail-IsSMTP();...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.