PHP mail()函数使用及配置方法 |
本文标签:PHP,mail 配置 工欲善其事,必先利其器 。首先我们以windows下面为例进行说明,如何配置一下本地的mail 。 下载附件 sendmail.zip 复制代码 代码如下: [sendmail] smtp_server=smtp.qq.com smtp_port=25 error_logfile=error.log debug_logfile=debug.log auth_username=***@qq.com auth_password=*** force_sender=***@qq.com -php.ini [mail function] SMTP = smtp.qq.com smtp_port = 25 sendmail_from = ***@qq.com sendmail_path = "D:/sendmail/sendmail.exe -t -i" mail.add_x_header = On 注意: 复制代码 代码如下: mail(to,subject,message,headers,parameters)
定义和用法 mail() 函数允许您从脚本中直接发送电子邮件 。 复制代码 代码如下: <?php $text = str_replace("\n.", "\n..", $text); ?> 提示和注释 注释:您需要紧记,邮件投递被接受,并不意味着邮件到达了计划的目的地 。 复制代码 代码如下: <?php $to = "somebody@example.com, somebodyelse@example.com"; $subject = "HTML email"; $message = " // 当发送 HTML 电子邮件时,请始终设置 content-type // 更多报头 mail($to,$subject,$message,$headers); |