php 傳送郵件

2021-07-07 08:04:51 字數 1360 閱讀 4478

<?php

require("./common/class.smtp.php");

$mail = new phpmailer();

//$body = $mail->getfile('contents.html');

//$body = eregi_replace("[\]",'',$body);

$mail->issmtp();

$mail->smtpauth = true; // 啟用smtp身份認證

$mail->smtpsecure = "ssl"; // 設定伺服器字首,gmail的smtp伺服器是ssl:

$mail->host = "smtp.gmail.com"; // 設定gmail的smtp伺服器

//$mail->host = $smtp; // 您的企業郵局網域名稱

$mail->port = 465; // gmail的smtp埠是465

$mail->username = "[email protected]"; // gmail使用者名稱

$mail->password = "******"; // gmail密碼

//$mail->username = $myemail; // 郵局使用者名稱(請填寫完整的email位址)

//$mail->password = $emailpassword; // 郵局密碼

$mail->from = "[email protected]";//傳送方位址

$mail->fromname = "paul yijiajia craft inc";//暱稱

$mail->subject = "測試";//標題

$mail->altbody = "測試內容正文"; //郵件正文

$mail->body = "測試內容正文"; //郵件正文

$mail->wordwrap = 50; // 50個字自動換行

//$mail->msghtml($body);

//$mail->addreplyto("[email protected]","webmaster");//自動**

//$mail->addattachment("/path/to/file.zip"); // 附件

//$mail->addattachment("/path/to/image.jpg", "new.jpg"); // 附件名稱可選

$mail->addaddress('[email protected]', 'tankerrr');//接收方位址

$mail->ishtml(true); // 以html格式傳送郵件

if(!$mail->send())

else

?>

php郵件傳送

今天要用到php的郵件傳送,便用phpmailer弄了個 類檔案 emaillclass.php class phpmailer function send addr,fromname,title,content smtp array array ehlo hello lb,220,250 ehlo...

php 郵件傳送

2 修改class.phpmailer.php 增加變數 fromemail 修改下面內容 成如下內容 if this fromname else result this headerline from this fromemail.fromname result this headerline r...

php 傳送郵件

results wpdb query sql 傳送郵件提醒有人申請 smtpserver smtp.qq.com smtp伺服器,如 smtp.qq.com smtpserverport 25 smtp伺服器端口,一般為25 smtpusermail 117 x837 qq.com smtp伺服器的...