用php发送email的有关问题

WBOY
Release: 2016-06-13 13:12:47
Original
978 people have browsed it

用php发送email的问题


//replace these next two variable with your email address and your web address
$yourEmailAddress = "251199169@qq.com";
$yourWebAddress = "www.cyhzxx.com";

//collect Posted variables
$name = $_POST['Name'];
$email = $_POST['Email'];
$message = $_POST['Message'];
//generic subject
$subject = "Message From Visitor";
//header
$header = 'From: '. $yourWebAddress . "\r\n" . 'Content-Type: text/html; charset=ISO-8859-1';
//email
$htmlEmail = "




Message from site visitor

Name : ".$name."

Email : ".$email."


Message :".$message."



";
//php mail function
mail($yourEmailAddress,$subject,$htmlEmail,$header);
echo("Message Sent!");
?>

大家看一下吧,意思就是 想把 别的页面提交过来的 信息 发送到我的邮箱 ,html我熟悉,但是php一点都不懂,这个代码源文件是 .php的,只有这些代码, 希望可以帮我讲解下这是怎么发送邮件的,而且 事实是这些代码没有作用,我的邮箱并没有收到邮件

------解决方案--------------------
关于email的内容,一般书上介绍的较为简洁。
$yourEmailAddress = "251199169@qq.com";
$yourWebAddress = "www.cyhzxx.com";
以上为变量赋值
$name = $_POST['Name'];
$email = $_POST['Email'];
$message = $_POST['Message'];
以上为POST表单获取
Message from site visitor

等4句为显示获得的表单信息
mail($yourEmailAddress,$subject,$htmlEmail,$header);
第一个参数:被发送地址;第二个参数:消息的主题,第三个:消息内容,貌似第四个: form来自哪个地址。
这么说清楚了吧,你的代码上面有
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!