php 郵件發送

來源:互聯網
上載者:User

標籤:style   blog   ar   color   os   使用   sp   for   檔案   

<?php    header("Content-Type:text/html;charset=utf-8");    require("./PHPMailer/class.phpmailer.php"); //下載的檔案必須放在該檔案所在目錄    $mail = new PHPMailer(); //建立郵件發送類    $address ="[email protected]";    $mail->IsSMTP(); // 使用SMTP方式發送    $mail->Host = "smtp.163.com"; // 您的企業郵局網域名稱,表示使用163伺服器發送郵件    $mail->SMTPAuth = true; // 啟用SMTP驗證功能    $mail->Username = "[email protected]"; // 郵局使用者名稱(請填寫完整的email地址)    $mail->Password = "********"; // 郵局密碼    $mail->Port=25;    $mail->From = "[email protected]"; //郵件寄件者email地址    $mail->FromName = "wei465501235";    $mail->AddAddress("$address", "liuweizhong");//收件者地址,可以替換成任何想要內送郵件的email信箱,格式是AddAddress("收件者email","收件者姓名")//$mail->AddReplyTo("", ""); //$mail->AddAttachment("/var/tmp/file.tar.gz"); // 添加附件//$mail->IsHTML(true); // set email format to HTML //是否使用HTML格式     $mail->Subject = "PHPMailer測試郵件"; //郵件標題    $mail->Body = "Hello,這是測試郵件,這是一個測試"; //郵件內容    //$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //附加資訊,可以省略     if(!$mail->Send())    {        echo "郵件發送失敗. <p>";        echo "錯誤原因: " . $mail->ErrorInfo;        exit;    }     echo "郵件發送成功";    

 

php 郵件發送

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.