本文整理汇总了PHP中smtp类的典型用法代码示例。如果您正苦于以下问题:PHP smtp类的具体用法?PHP smtp怎么用?PHP smtp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了smtp类的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: connect
function connect($params = array())
{
if (!isset($this->status)) {
$obj = new smtp($params);
if ($obj->connect()) {
$obj->status = SMTP_STATUS_CONNECTED;
}
return $obj;
} else {
if (!empty($GLOBALS['_CFG']['smtp_ssl'])) {
$this->host = "ssl://" . $this->host;
}
$this->connection = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
if ($this->connection === false) {
$this->errors[] = 'Access is denied.';
return false;
}
@socket_set_timeout($this->connection, 0, 250000);
$greeting = $this->get_data();
if (is_resource($this->connection)) {
$this->status = 2;
return $this->auth ? $this->ehlo() : $this->helo();
} else {
log_write($errstr, __FILE__, __LINE__);
$this->errors[] = 'Failed to connect to server: ' . $errstr;
return false;
}
}
}
示例3: 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);
}
示例4: 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 "恭喜!邮件发送成功!!";
}
示例5: 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;
}
示例6: mail_notice
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';
}
}
示例7: array
function &connect($params = array())
{
if (!isset($this->status))
{
$obj = new smtp($params);
if ($obj->connect())
$obj->status = SMTP_STATUS_CONNECTED;
return $obj;
}
else
{
$this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
if (function_exists('socket_set_timeout'))
@socket_set_timeout($this->connection, 5, 0);
$greeting = $this->get_data();
if (is_resource($this->connection))
return $this->auth ? $this->ehlo() : $this->helo();
else
{
$this->errors[] = 'Failed to connect to server: ' . $errstr;
return false;
}
}
}
示例8: SEND_MAIL
function SEND_MAIL()
{
$main = new maincf_multi($_POST["hostname"]);
$ipaddr = $main->ip_addr;
include_once dirname(__FILE__) . "/ressources/smtp/smtp.php";
$Parms["host"] = $ipaddr;
$Parms["DonotResolvMX"] = true;
$smtp = new smtp($Parms);
$smtp->bindto = $_POST["TESTS-BIND"];
$smtp->from = $_POST["TESTS-FROM"];
$smtp->recipients = $_POST["TESTS-TO"];
$f[] = "Return-Path: <{$_POST["TESTS-FROM"]}>";
$f[] = "Subject: {$_POST["TESTS-SUB"]}";
$f[] = "From: {$_POST["TESTS-FROM"]}";
$f[] = "Sender: {$_POST["TESTS-FROM"]}";
$f[] = "Reply-To: {$_POST["TESTS-FROM"]}";
$f[] = "X-Sender: {$_POST["TESTS-FROM"]}";
$f[] = "Envelope-To: {$_POST["TESTS-TO"]}";
$smtp->headers = @implode("\n", $f);
$smtp->body = $_POST["TESTS-BOD"];
if (!$smtp->connect()) {
echo "Instance {$_POST["hostname"]}\nIP: {$ipaddr}:25\n";
echo @implode("\n", $smtp->errors);
return;
}
if (!$smtp->send()) {
echo @implode("\n", $smtp->errors);
return;
}
echo @implode("\n", $smtp->errors);
}
示例9: 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);
}
示例10: 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
示例11: 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);
}
示例12: 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;
}
示例13: 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));
//请重新发送
}
}
}
示例14: 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);
}
}
示例15: 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;
}
}