php mail to 配置详解

yipeiwu_com5年前PHP代码库
复制代码 代码如下:

[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.";
}

相关文章

PHP 中英文混合排版中处理字符串常用的函数

# 判断某个位置是中文字符的左还是右半部分,或不是中文  # 返回值 -1 左 0 不是中文字符 1&nb...

PHP5下$_SERVER变量不再受magic_quotes_gpc保护的弥补方法

复制代码 代码如下: <?php $magic_quotes_gpc = get_magic_quotes_gpc(); @extract(daddslashes($_COOKIE...

PHP XML数据解析代码

复制代码 代码如下: //xml string $xml_string="<?xml version='1.0'?> <users> <user id='3...

Win下如何安装PHP的APC拓展

Win下如何安装PHP的APC拓展

APC简介APC(Alternative PHP Cache)是一个PHP缓存。它在内存中存储PHP页面并且减少了硬盘的I/O。这对于性能的提升十分明显。你甚至可以在CPU使用率下降50...

PHP Header用于页面跳转时的几个注意事项

前言 本文介绍的是在PHP中用header("location:test.php")进行跳转要注意以下几点,有助于解决一些新手经常遇到的问题 一、location和“:”号间不能有空格,...