请问PHP网站会员邮件找回密码功能的代码该怎么设置呢?
<?php/***邮件发送函数*@copyright(C)2005-2010PHPCMS*@licensehttp://www.phpcms.cn/license/*@l...
<?php
/**
* 邮件发送函数
* @copyright (C) 2005-2010 PHPCMS
* @license http://www.phpcms.cn/license/
* @lastmodify 2010-6-1
*/
function runlog($mode = 'SMTP',$b = '',$c = '',$d='') {
}
/**
* 发送邮件
* @param $toemail 收件人email
* @param $subject 邮件主题
* @param $message 正文
* @param $from 发件人
* @param $cfg 邮件配置信息
* @param $sitename 邮件站点名称
*/
function sendmail($toemail, $subject, $message, $from='',$cfg = array(), $sitename='') {
$sitename= config_item('site_name');
if($cfg && is_array($cfg)) {
$from = $cfg['from'];
$mail = $cfg;
$mail_type = $cfg['mail_type']; //邮件发送模式
} else {
$cfg = array(
'admin_email' => 'phpcms@phpcms.cn',
'maxloginfailedtimes' => '8',
'minrefreshtime' => '2',
'mail_type' => '1',
'mail_server' => 'smtp.exmail.qq.com',
'mail_port' => '25',
'category_ajax' => '0',
'mail_user' => 'servic@548.com',
'mail_auth' => '1',
'mail_from' => 'servic@548.com',
'mail_password' => '334180',
'errorlog_size' => '20',
);
$from = $cfg['mail_from'];
$mail_type = $cfg['mail_type']; //邮件发送模式
if($cfg['mail_user']=='' || $cfg['mail_password'] ==''){
return false;
}
$mail= Array (
'mailsend' => 2,
'maildelimiter' => 1,
'mailusername' => 1,
'server' => $cfg['mail_server'],
'port' => $cfg['mail_port'],
'auth' => $cfg['mail_auth'],
'from' => $cfg['mail_from'],
'auth_username' => $cfg['mail_user'],
'auth_password' => $cfg['mail_password']
);
}
//mail 发送模式
if($mail_type==0) {
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset='.config_item('charset').'' . "\r\n";
$headers .= 'From: '.$sitename.' <'.$from.'>' . "\r\n";
mail($toemail, $subject, $message, $headers);
return true;
}
//邮件头的分隔符
$maildelimiter = $mail['maildelimiter'] == 1 ? "\r\n" : ($mail['maildelimiter'] == 2 ? "\r" : "\n");
//收件人地址中包含用户名
$mailusername = isset($mail['mailusername']) ? $mail['mailusername'] : 1;
//端口
$mail['port'] = $mail['port'] ? $mail['port'] : 25;
$mail['mailsend'] = $mail['mailsend'] ? $mail['mailsend'] : 1; 展开
/**
* 邮件发送函数
* @copyright (C) 2005-2010 PHPCMS
* @license http://www.phpcms.cn/license/
* @lastmodify 2010-6-1
*/
function runlog($mode = 'SMTP',$b = '',$c = '',$d='') {
}
/**
* 发送邮件
* @param $toemail 收件人email
* @param $subject 邮件主题
* @param $message 正文
* @param $from 发件人
* @param $cfg 邮件配置信息
* @param $sitename 邮件站点名称
*/
function sendmail($toemail, $subject, $message, $from='',$cfg = array(), $sitename='') {
$sitename= config_item('site_name');
if($cfg && is_array($cfg)) {
$from = $cfg['from'];
$mail = $cfg;
$mail_type = $cfg['mail_type']; //邮件发送模式
} else {
$cfg = array(
'admin_email' => 'phpcms@phpcms.cn',
'maxloginfailedtimes' => '8',
'minrefreshtime' => '2',
'mail_type' => '1',
'mail_server' => 'smtp.exmail.qq.com',
'mail_port' => '25',
'category_ajax' => '0',
'mail_user' => 'servic@548.com',
'mail_auth' => '1',
'mail_from' => 'servic@548.com',
'mail_password' => '334180',
'errorlog_size' => '20',
);
$from = $cfg['mail_from'];
$mail_type = $cfg['mail_type']; //邮件发送模式
if($cfg['mail_user']=='' || $cfg['mail_password'] ==''){
return false;
}
$mail= Array (
'mailsend' => 2,
'maildelimiter' => 1,
'mailusername' => 1,
'server' => $cfg['mail_server'],
'port' => $cfg['mail_port'],
'auth' => $cfg['mail_auth'],
'from' => $cfg['mail_from'],
'auth_username' => $cfg['mail_user'],
'auth_password' => $cfg['mail_password']
);
}
//mail 发送模式
if($mail_type==0) {
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset='.config_item('charset').'' . "\r\n";
$headers .= 'From: '.$sitename.' <'.$from.'>' . "\r\n";
mail($toemail, $subject, $message, $headers);
return true;
}
//邮件头的分隔符
$maildelimiter = $mail['maildelimiter'] == 1 ? "\r\n" : ($mail['maildelimiter'] == 2 ? "\r" : "\n");
//收件人地址中包含用户名
$mailusername = isset($mail['mailusername']) ? $mail['mailusername'] : 1;
//端口
$mail['port'] = $mail['port'] ? $mail['port'] : 25;
$mail['mailsend'] = $mail['mailsend'] ? $mail['mailsend'] : 1; 展开
1个回答
2015-02-23 · 知道合伙人软件行家
百度网友ad45923b8
知道合伙人软件行家
向TA提问 私信TA
知道合伙人软件行家
采纳数:262
获赞数:386
从事IT互联网行业16年,经验丰富,擅长ASP、HTML、Javascript,Css,JQuery,PHP,PS,FL,AI,E,服务器等
向TA提问 私信TA
关注
展开全部
PHPCMS的找回密码功能,在后台就可以进行配置的啊,首先进行邮件配置,然后再进行邮件模板编辑
更多追问追答
追问
我这套源码没有那种可以设置的邮件的后台 功能都是代码实现的
追答
修改这几个配置参数就可以了。
'mail_server' => 'smtp.exmail.qq.com',
'mail_user' => 'servic@548.com',
'mail_from' => 'servic@548.com',
'mail_password' => '334180',
Zoho Mail
2024-11-18 广告
2024-11-18 广告
外贸公司如何注册邮箱?做国际业务一定是要用到能做外贸的邮箱,给大家普及下最近网上说的TOM VIP邮箱。注册邮箱通常需要以下几个步骤选择邮箱服务提供商:首先,您需要选择一个合适的邮箱服务提供商。您可以根据服务商的知名度、口碑、容量、速度、安...
点击进入详情页
本回答由Zoho Mail提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询