欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

php mail to 配置详解

程序员文章站 2023-12-11 13:12:46
复制代码 代码如下: [mail function] ; for win32 only. smtp = mail3.focuschina.com smtp_port = 2...
复制代码 代码如下:

[mail function]
; for win32 only.
smtp = mail3.focuschina.com
smtp_port = 25

; for win32 only.
;sendmail_from = me@example.com

仅仅配置了如上的代码,没有用到用户名和密码,测试代码成功发送邮件
好读书,不求甚解。。以上

发送的测试代码:
复制代码 代码如下:

<?php

[php] view plaincopyprint?在code上查看代码片派生到我的代码片

$subject = iconv('utf-8', 'gbk', "邮件标题");
$message = iconv('utf-8', 'gbk', "邮件内容发打发打发fasdfadsfasdf");
$from ='oa<noreply@made-in-china.com>';
$from = iconv('utf-8', 'gbk', $from);
$headers = "from: " . $from . "\ncontent-type: text/html; charset=gbk; mime-version: 1.0'\n";
$to="xuedagong@163.com";
if(mail($to, $subject, $message,$headers)){
echo "ok.";
}else{
echo "fail.";
}

上一篇:

下一篇: