PHP自带邮件发送配置
来源:互联网 发布:大数据与信息安全论文 编辑:程序博客网 时间:2024/06/06 02:35
先去下载一个SENDMAIL在WINDOWS下的软件,随便放在哪里,自己知道就好,不要用中文
接着就是配置了。
先来看看PHP.ini的配置。
[mail function]; For Win32 only.; SMTP = localhost; smtp_port = 25; For Win32 only.; sendmail_from = me@example.com; For Unix only.You may supply arguments as well (default: "sendmail -t -i"). sendmail_path = "D:\PHP5\sendmail\sendmail.exe -t"; Force the addition of the specified parameters to be passed as extra parameters; to the sendmail binary. These parameters will always replace the value of; the 5th parameter to mail(), even in safe mode.;mail.force_extra_parameters =smtp_server=你要使用的发送的邮箱的smtp地址 如 smtp.qq.com smtp.163.comauth_username=你要使用的用户名xxxx@163.comauth_password=邮箱密码force_sender=发件人地址全写(可以不填)接着到你用的邮箱里面设置一下,将SMTP功能打开就OK了。测试代码<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Aliens Abducted Me - Report an Abduction</title> <link rel="stylesheet" type="text/css" href="style.css" /></head><body> <h2>Aliens Abducted Me - Report an Abduction</h2> <p>Share your story of alien abduction:</p> <form method="post" action="report.php"> <label for="firstname">First name:</label> <input type="text" id="firstname" name="firstname" /><br /> <label for="lastname">Last name:</label> <input type="text" id="lastname" name="lastname" /><br /> <label for="email">What is your email address?</label> <input type="text" id="email" name="email" /><br /> <label for="whenithappened">When did it happen?</label> <input type="text" id="whenithappened" name="whenithappened" /><br /> <label for="howlong">How long were you gone?</label> <input type="text" id="howlong" name="howlong" /><br /> <label for="howmany">How many did you see?</label> <input type="text" id="howmany" name="howmany" /><br /> <label for="aliendescription">Describe them:</label> <input type="text" id="aliendescription" name="aliendescription" size="32" /><br /> <label for="whattheydid">What did they do to you?</label> <input type="text" id="whattheydid" name="whattheydid" size="32" /><br /> <label for="fangspotted">Have you seen my dog Fang?</label> Yes <input id="fangspotted" name="fangspotted" type="radio" value="yes" /> No <input id="fangspotted" name="fangspotted" type="radio" value="no" /><br /> <img src="fang.jpg" width="100" height="175" alt="My abducted dog Fang." /><br /> <label for="other">Anything else you want to add?</label> <textarea id="other" name="other"></textarea><br /> <input type="submit" value="Report Abduction" name="submit" /> </form></body></html>css样式form label { display: inline-block; width: 225px; font-weight: bold;}<pre name="code" class="php"><pre name="code" class="html"><html><head> <title>Aliens abducted me - Report an abduction</title></head><body><h2>Aliens Abducted Me -Report an Abduction</h2><?php$name = $_POST['firstname'] . ' ' . $_POST['lastname'];$how_many = $_POST['howmany'];$what_they_did = $_POST['whattheydid'];$other = $_POST['other'];$when_it_happened = $_POST['whenithappened'];$how_long = $_POST['howlong'];$alien_description = $_POST['aliendescription'];$fang_spotted = $_POST['fangspotted'];$email = $_POST['email'];$to = 'emample@qq.com'; //你要接受的地址$subject = 'Aliens Abducted Me - Abduction Report';$msg = "$name was abducted $when_it_happened and was gone for $how_long.\n" . "Number of aliens:$how_many\n" . "Alien description: $alien_description\n" . "What they did: $what_they_did\n" . "Fang spotted: $fang_spotted\n" . "Other comments: $other";mail($to,$subject,$msg,'From:'.$email);echo 'Thanks for submitting the form.<br />';echo 'You were abducted ' . $when_it_happened;echo ' and were gone for ' . $how_long . '<br />';echo 'Number of aliens:' . $how_many . '<br />';echo 'Describe them: ' . $alien_description . '<br />';echo 'The allens did this:' . $what_they_did . '<br />';echo 'Was Fang there? ' . $fang_spotted . '<br />';echo 'Other comments:' . $other . '<br />';echo "Your email address is " . $email;?></body></html></pre><pre name="code" class="html">折腾了大半天终于弄好了,真不容易~~
0 0
- PHP自带邮件发送配置
- linux Busybox 使用自带sendmail发送邮件以及php mail函数相应配置
- laravel自带SMTP邮件发送配置修改
- php 发送带附件邮件
- PHP发送邮件带附件
- 学习笔记:不用SQLSERVER中自带的发送邮件如何配置邮件
- python自带模块发送邮件
- PHP中用pear包自带的类发送带有附件的邮件
- php 配置smtp发送邮件
- php 发送带附件的邮件
- php 发送带附件的邮件
- PHP发送邮件(带附件)类
- php linux 发送带附件邮件
- php发送文本邮件和带附件邮件
- PHP 发送邮件配置 转发自http://www.cnblogs.com/dee0912/p/5448350.html
- windows下使用php自带的mail函数实现简单的邮件发送实例(QQ亲试成功)
- C#.Net下用自带的邮件发送类
- 使用.NET 自带的组建发送邮件
- LeetCode 145 Binary Tree Postorder Traversal
- IGMP Snooping
- 安卓Android控件ListView获取item中EditText值
- C++继承总结
- HDU 4619 (二分图匹配 最大独立集)
- PHP自带邮件发送配置
- MyBatis 学习笔记一
- Github添加SSH Key
- POJ 1797 Heavy Transportation
- group by having where
- hdu 2639 Bone Collector II 01背包 第k优解
- mysql数据库学习
- C 读写文件
- 牛客堂刷题(常见面试题精讲)之左右最大值之差