php发送邮件怎样才能自定义发件人名称请老师指教,该怎么解决
程序员文章站
2022-06-16 23:31:15
...
php发送邮件怎样才能自定义发件人名称请老师指教
请老师指教在那添加代码自定义发件人名称
例如
require '../mail_config.php';
require 'axphp_email.php';
$title=$_POST['title'];
$content=$_POST['content'];
$senddoemain=$_POST['senddoemain'];
$smtpserver = $axphp['server'];
$smtpserverport =$axphp['port'];
$smtpusermail = $axphp['email'];
$smtpuser = $axphp['mailuser'];
$smtppass = $axphp['mailpass'];
$mailsubject = $title;
$mailbody = $content;
$mailtype = "HTML";
$sb=0;
$sendarray=explode(",",$senddoemain);
$emailnum=count($sendarray);
foreach($sendarray as $emaildododo)
{
$smtpemailto = $emaildododo;
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
$smtp->debug = false;
$smtp->sendmail($smtpemailto,$smtpusermail,$mailsubject,$mailbody,$mailtype);
}
;echo '
';?>
------解决方案--------------------
想了想,有了fromemail肯定有From头,你看这个sendmail函数,里面有没有设置请求头的。
From头要弄成
请老师指教在那添加代码自定义发件人名称
例如
require '../mail_config.php';
require 'axphp_email.php';
$title=$_POST['title'];
$content=$_POST['content'];
$senddoemain=$_POST['senddoemain'];
$smtpserver = $axphp['server'];
$smtpserverport =$axphp['port'];
$smtpusermail = $axphp['email'];
$smtpuser = $axphp['mailuser'];
$smtppass = $axphp['mailpass'];
$mailsubject = $title;
$mailbody = $content;
$mailtype = "HTML";
$sb=0;
$sendarray=explode(",",$senddoemain);
$emailnum=count($sendarray);
foreach($sendarray as $emaildododo)
{
$smtpemailto = $emaildododo;
$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);
$smtp->debug = false;
$smtp->sendmail($smtpemailto,$smtpusermail,$mailsubject,$mailbody,$mailtype);
}
;echo '
';?>
------解决方案--------------------
想了想,有了fromemail肯定有From头,你看这个sendmail函数,里面有没有设置请求头的。
From头要弄成