本文整理匯總了PHP中smtp::sendmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP smtp::sendmail方法的具體用法?PHP smtp::sendmail怎麽用?PHP smtp::sendmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類smtp
的用法示例。
在下文中一共展示了smtp::sendmail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendEmail
protected function sendEmail($smtpemailto, $mailsubject, $text)
{
import("ORG.Util.Smtp");
$smtpserver = "smtp.126.com";
//SMTP服務器
$smtpserverport = 25;
//SMTP服務器端口
$smtpusermail = "tianyu0915@126.com";
//SMTP服務器的用戶郵箱
//$smtpemailto = "tianyu0915@gmail.com";//發送給誰
$smtpuser = "tianyu0915";
//SMTP服務器的用戶帳號
$smtppass = "122126382";
//SMTP服務器的用戶密碼
//$mailsubject = "[Ty]";//郵件主題
$mailbody = $text;
//郵件內容
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = FALSE;
//是否顯示發送的調試信息
$result = $smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
return $result;
}
示例2: sendEmail
/**
* Created by PhpStorm.
* User: master
* Date: 2016/3/2
* Time: 20:57
*/
function sendEmail($addr, $title, $body)
{
$smtpserver = "smtp.163.com";
//SMTP服務器
$smtpserverport = 25;
//SMTP服務器端口,一般為25
$smtpusermail = "cotestpublic@163.com";
//SMTP服務器的用戶郵箱
$smtpuser = "cotestpublic";
//SMTP服務器的用戶帳號
$smtppass = "cotest123";
//SMTP服務器的用戶密碼
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//實例化郵件類
$emailtype = "HTML";
//信件類型
$smtpemailto = $addr;
//接收郵件方
$smtpemailfrom = $smtpusermail;
//發送郵件方
$emailsubject = $title;
//郵件標題
$smtp->debug = false;
//郵件主體內容
$emailbody = $body;
//發送郵件
$rs = $smtp->sendmail($smtpemailto, $smtpemailfrom, $emailsubject, $emailbody, $emailtype);
if ($rs != "") {
$rst = true;
} else {
$rst = false;
}
return $rst;
}
示例3: send_email
/**
*$to_email 發送的人
*$title 郵箱標題
*$content 有些內容
*/
function send_email($to_email, $title, $content)
{
require_once "email.class.php";
//##########################################
$smtpserver = "smtp.163.com";
//SMTP服務器
$smtpserverport = "25";
//SMTP服務器端口
$smtpusermail = "morton991@163.com";
//SMTP服務器的用戶郵箱
$smtpemailto = $to_email;
//發送給誰
$smtpuser = "morton991@163.com";
//SMTP服務器的用戶帳號
$smtppass = "userpeng123";
//SMTP服務器的用戶密碼
$mailsubject = iconv("UTF-8", "gbk", $title);
//郵件主題
$mailbody = iconv("UTF-8", "gbk", $content);
//郵件內容
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
##########################################
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = false;
//是否顯示發送的調試信息
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
}
示例4: email
function email()
{
global $dir;
//引入發送郵件類
require $dir . "www/smtp.php";
//使用163郵箱服務器
$smtpserver = "smtp.exmail.qq.com";
//163郵箱服務器端口
$smtpserverport = 25;
//你的163服務器郵箱賬號
$smtpusermail = "r@.com";
//收件人郵箱
$smtpemailto = "xxxxxxxxxxqq.com";
//你的郵箱賬號(去掉@163.com)
$smtpuser = "xxx@xxx.com";
//SMTP服務器的用戶帳號
//你的郵箱密碼
$smtppass = "xxxx";
//SMTP服務器的用戶密碼
//郵件主題
$mailsubject = "測試郵件發送";
//郵件內容
$mailbody = "PHP+MySQL";
//郵件格式(HTML/TXT),TXT為文本郵件
$mailtype = "TXT";
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//是否顯示發送的調試信息
$smtp->debug = false;
//發送郵件
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
}
示例5: sendEmail
function sendEmail($email)
{
//此處的$email變量是發送的目的郵件
//下麵開始設置一些信息
$smtpserver = "smtp.qq.com";
//SMTP服務器
$smtpserverport = 25;
//SMTP服務器端口
$smtpusermail = "1261810665@qq.com";
//SMTP服務器的用戶郵箱
$smtpemailto = $email;
//發送給誰(可以填寫任何郵箱地址)
$smtpuser = "1261810665";
//SMTP服務器的用戶帳號(即SMTP服務器的用戶郵箱@前麵的信息)
$smtppass = "xxx(xxx代表1261810665@qq.com的密碼)";
//SMTP服務器的用戶密碼
$mailtitle = 'UNeed';
//郵件主題
$mailcontent = "<h1>您成功發送了一條電子郵件</h1>";
//郵件內容
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = false;
//是否顯示發送的調試信息
$state = $smtp->sendmail($smtpemailto, $smtpusermail, $mailtitle, $mailcontent, $mailtype);
if ($state == "") {
echo "對不起,郵件發送失敗!請檢查郵箱填寫是否有誤。";
exit;
}
echo "恭喜!郵件發送成功!!";
}
示例6: sendmail
function sendmail($smtpemailto, $title, $content)
{
$rs = mysql_fetch_array(mysql_query("select * from sitinfo where id = 1;"));
$websmtp = $rs["websmtp"];
$email = $rs["email"];
$mailuser = $rs["mailuser"];
$smtpport = $rs["smtpport"];
$mailpassword = $rs["mailpassword"];
$smtpserver = $websmtp;
//SMTP服務器
$smtpserverport = 25;
//SMTP服務器端口
$smtpusermail = $email;
//SMTP服務器的用戶郵箱
$smtpemailto = $smtpemailto;
//發送給誰
$smtpuser = $mailuser;
//SMTP服務器的用戶帳號
$smtppass = $mailpassword;
//SMTP服務器的用戶密碼
$mailsubject = $title;
//郵件主題
$mailbody = $content;
//郵件內容
$mailtype = "HTML";
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
$smtp->debug = false;
//是否顯示發送的調試信息
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
}
開發者ID:wuleiyang,項目名稱:SublimeText,代碼行數:30,代碼來源:email.php++++++++++++++++D%3A%5CProgram+Files%5CFlashFXP%5CCache%5C%7Eflashfxp%5C52C220D5_edit.tmp%5Cemail.php
示例7: date
function mail_notice()
{
//******************** 配置信息 ********************************
$smtpserver = "smtp.qq.com";
//SMTP服務器
$smtpserverport = 25;
//SMTP服務器端口
$smtpusermail = "707719848@qq.com";
//SMTP服務器的用戶郵箱
$smtpemailto = 'keensting0712@163.com';
//發送給誰
$smtpuser = "707719848";
//SMTP服務器的用戶帳號
$smtppass = "lx19950712jiao";
//SMTP服務器的用戶密碼
$mailtitle = '學校數據更新完畢!';
//郵件主題
$mailcontent = "<h1>更新時間:" . date('Y-m-d h:i:sa') . "</h1>";
//郵件內容
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
//************************ 配置信息 ****************************
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = false;
//是否顯示發送的調試信息
$state = $smtp->sendmail($smtpemailto, $smtpusermail, $mailtitle, $mailcontent, $mailtype);
if ($state == '') {
echo 'failed';
}
}
示例8: eSmtp
function eSmtp($email)
{
//使用163郵箱服務器
$smtpserver = "smtp.163.com";
//163郵箱服務器端口
$smtpserverport = 25;
//你的163服務器郵箱賬號
$smtpusermail = "yy_lfy@163.com";
//收件人郵箱
$smtpemailto = $email;
//"yy_lfy@126.com";
//你的郵箱賬號(去掉@163.com)
$smtpuser = "yy_lfy";
//SMTP服務器的用戶帳號
//你的郵箱密碼
$smtppass = "yueyi@810718";
//SMTP服務器的用戶密碼
//郵件主題
$mailsubject = "測試郵件發送";
//$mailsubject = '=?UTF-8?B?'.base64_encode($mailsubject).'?=';
//郵件內容
$mailbody = "<p>PHP+MySQL測試郵件發送</p><p><a href=\"http://baidu.com\">baidu</a>";
//郵件格式(HTML/TXT),TXT為文本郵件
$mailtype = "HTML";
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//是否顯示發送的調試信息
$smtp->debug = TRUE;
//發送郵件
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);
}
示例9: mail_core
function mail_core($smtpemailto, $mailtitle, $mailcontent, $mailtype)
{
$smtp = new smtp($GLOBALS["smtpserver"], $GLOBALS["smtpserverport"], true, $GLOBALS["smtpuser"], $GLOBALS["smtppass"]);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = false;
//是否顯示發送的調試信息
$state = $smtp->sendmail($smtpemailto, $GLOBALS["smtpusermail"], $mailtitle, $mailcontent, $mailtype);
return $state;
}
示例10: password
public function password()
{
if (!IS_POST) {
_404("頁麵不存在");
}
$email = I('username', '', 'htmlspecialchars');
if (I("verify", "", "md5") != session("verify")) {
//驗證碼錯誤;
$this->ajaxReturn(array('status' => 2));
return 0;
} else {
// $this->ajaxReturn(array('status'=>1));//發送成功!
import('Class.smtp', APP_PATH);
date_default_timezone_set('Asia/Shanghai');
$time = time();
$appy_time = date('Y-m-d H:i', $time);
$data = M();
$sql = "select id from dm_user where username= '{$email}'";
$result = $data->query("select id from dm_user where username= '{$email}'");
$reset = $data->query("update dm_user set resettime={$time} where username ='{$email}'");
$id = base64_encode($result[0]['id']);
//使用base64對數據加密
$url = U('index/Password/reset?time=' . $time . '&yxs=' . $id . '&mail=' . $email);
$MailServer = 'smtp.163.com';
//SMTP 服務器
$MailPort = '25';
//SMTP服務器端口號 默認25
$MailId = 'daymeng@163.com';
//服務器郵箱帳號
$MailPw = 'checent.com';
//服務器郵箱密碼
$Title = '呆萌網找回登陸密碼!';
//郵件標題
$Content = '呆萌網在 ' . $appy_time . ' 收到了郵箱 ' . $email . ' 的密碼重置申請。請點擊以下的鏈接修改密碼:
</br>
http://' . $_SERVER['HTTP_HOST'] . $url . '
</br>
如果郵箱中不能打開鏈接,您也可以將它複製到瀏覽器地址欄中打開。';
//郵件內容
$email = $email;
//接收者郵箱
$smtp = new smtp($MailServer, $MailPort, true, $MailId, $MailPw);
$smtp->debug = false;
if ($smtp->sendmail($email, $MailId, $Title, $Content, "HTML")) {
$this->ajaxReturn(array('status' => 1));
//發送成功!
} else {
$this->ajaxReturn(array('status' => 3));
//請重新發送
}
}
}
示例11: sendmail
/**
* 郵件發送函數
*
* @param string $email E-mail地址
* @param string $mailtitle E-mail標題
* @param string $mailbody E-mail內容
* @param string $headers 頭信息
* @return void
*/
function sendmail($email, $mailtitle, $mailbody, $headers)
{
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_user, $cfg_smtp_password, $cfg_adminemail;
if ($cfg_sendmail_bysmtp == 'Y') {
$mailtype = 'TXT';
require_once DEDEINC . '/mail.class.php';
$smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
$smtp->debug = false;
$smtp->sendmail($email, $cfg_webname, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
} else {
@mail($email, $mailtitle, $mailbody, $headers);
}
}
示例12: foreach
function mail_notice()
{
//******************** 配置信息 ********************************
$smtpserver = "smtp.qq.com";
//SMTP服務器
$smtpserverport = 25;
//SMTP服務器端口
$smtpusermail = "707719848@qq.com";
//SMTP服務器的用戶郵箱
$smtpemailto = 'keensting0712@163.com';
//發送給誰
$smtpuser = "707719848";
//SMTP服務器的用戶帳號
$smtppass = "lx19950712jiao";
//SMTP服務器的用戶密碼
$mailtitle = '訂單數據審核完畢!';
//郵件主題
$mailcontent = '';
foreach ($this->mail_content as $v) {
$mailcontent .= $v . '<br>';
}
date_default_timezone_set('PRC');
$mailcontent .= "<h1>更新時間:" . date('Y-m-d h:i:sa') . "</h1>";
//郵件內容
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
//************************ 配置信息 ****************************
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = false;
//是否顯示發送的調試信息
$state = $smtp->sendmail($smtpemailto, $smtpusermail, $mailtitle, $mailcontent, $mailtype);
$smtp->sendmail('502599073@qq.com', $smtpusermail, $mailtitle, $mailcontent, $mailtype);
//給石頭發一份
if ($state == '') {
echo 'failed';
}
}
示例13: sendEmail
function sendEmail()
{
$smtp = new smtp($this->smtpserver, $this->smtpserverport, true, $this->smtpuser, $this->smtppass);
//這裏麵的一個true是表示使用身份驗證,否則不使用身份驗證.
$smtp->debug = false;
//是否顯示發送的調試信息
$state = $smtp->sendmail($this->smtpemailto, $this->smtpusermail, $this->mailtitle, $this->mailcontent, $this->mailtype);
echo "<div style='width:300px; margin:36px auto;'>";
if ($state == "") {
return false;
} else {
return true;
}
}
示例14: sendmail
public function sendmail()
{
//include_once(ROOT_PATH."/application/controllers/mail.inc.php");
$smtp = new smtp("smtp.163.com", 25, true, "testacemap@163.com", "mxanahtmyfukwgxa", "testacemap@163.com");
//發件人信箱信息
$smtp->debug = TRUE;
//是否顯示發送的調試信息 FALSE or TRUE
$mailto = "testacemap@163.com";
//收件人信箱
$mailsubject = "Feedback";
$mailfrom = "Acemap user";
$mailbody = "Name:" . $_POST["q1"] . "<br>";
$mailbody = $mailbody . "Phone No:" . $_POST["q2"] . "<br>";
$mailbody = $mailbody . "Suburb:" . $_POST["q3"] . "<br>";
$mailbody = $mailbody . "Email:" . $_POST["email"] . "<br>";
$mailbody = $mailbody . "Message:" . $_POST["q4"] . "<br>";
//其他的表單項目以此類推
$mailtype = "HTML";
//郵件格式(HTML/TXT),TXT為文本郵件
$mailsubject = '=?UTF-8?B?' . base64_encode($mailsubject) . '?=';
//郵件主題
$mailfrom = '=?UTF-8?B?' . base64_encode($mailfrom) . '?=';
//發件人
$smtp->sendmail($mailto, $mailfrom, $mailsubject, $mailbody, $mailtype);
echo "<script language=\"JavaScript\">alert(\"Send success.\");</script>";
echo "<script language=\"JavaScript\">history.go(-1);</script>";
exit;
/*
$this->load->library('email');
$config['smtp_host']='smtp.163.com';
$config['smtp_post']='25';
$config['smtp_user']='testacemap@163.com';
$config['smtp_pass']='mxanahtmyfukwgxa';
$this->email->initialize($config);
$this->email->from("testacemap@163.com","acemap");
$this->email->to('testacemap@163.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
echo $this->email->print_debugger();
*/
}
示例15: sendmail
function sendmail($email, $mailtitle, $mailbody)
{
global $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_user, $cfg_smtp_password, $cfg_adminemail, $cfg_webname;
if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_server)) {
$mailtype = 'HTML';
require_once DEDEINC . '/mail.class.php';
$smtp = new smtp($cfg_smtp_server, $cfg_smtp_port, true, $cfg_smtp_usermail, $cfg_smtp_password);
$smtp->debug = false;
if (!$smtp->smtp_sockopen($cfg_smtp_server)) {
ShowMsg('郵件發送失敗,請聯係管理員', '-1');
exit;
}
$smtp->sendmail($email, $cfg_webname, $cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
} else {
@mail($email, $mailtitle, $mailbody, $headers);
}
}