php傳送郵件email

2021-07-22 02:43:04 字數 1391 閱讀 6815

<?php    

header("content-type:text/html;charset=utf-8");

include("class.phpmailer.php");

include("class.smtp.php");

$mail = new phpmailer();

$mail->issmtp(); //設定使用smtp伺服器傳送

$mail->host = "smtp.163.com"; // smtp servers

$mail->smtpauth = true; // 開啟smtp認證

$mail->username = "*********"; // 發信人的郵箱名稱 注意:普通郵件認證不需要加 @網域名稱

$mail->password = "*****"; // 發信人的郵箱密碼

$mail->from = "******@163.com"; // 發件人完整的郵箱名稱

$mail->fromname = "***"; // 發件人署名

$mail->charset = "utf-8"; // 這裡指定字符集!

$mail->encoding = "base64";

$mail->addaddress("******@163.com","toyou"); // 收件人郵箱和姓名

$mail->addreplyto("******@163.com","wo");

//$mail->wordwrap = 20; // set word wrap 換行字數

//$mail->addattachment("/var/tmp/file.tar.gz"); // attachment 附件

$mail->ishtml(true); // 指定郵件格式為html 不加true 預設以text方式解析

// 郵件主題

$subject="測試";

$mail->subject = $subject;

$mail->body = "testing the email class

"; // 郵件內容

$mail->altbody ="text/html";

if(!$mail->send())

else

ci框架中使用

public function sendemail()  

linux shell 傳送email 郵件

方法一 簡單郵件傳送 echo hello world mail s subject t yanggang ithomer.com,yanggang 2050 163.com a from 463103470 qq.com 效果截圖 方法二 文字格式傳送郵件 python view plain co...

linux shell 傳送email 郵件

方法一 簡單郵件傳送 echo hello world mail s subject t yanggang ithomer.com,yanggang 2050 163.com a from 463103470 qq.com 效果截圖 方法二 文字格式傳送郵件 bin shfrom name from...

JAVA傳送Email郵件

使用apache的commons email傳送郵件 首先在pom中新增依賴 org.apache.commons commons email 1.21 傳送簡單郵件 email email new email email.sethostname smtp.gmail.com email.setsm...