求php里面自动发email给用户邮箱的相关代码 (100分送上 在线等) php里面用户填完表格后,自动发email给用户邮箱的相关代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 表单提交之后,你调用一下 mail函数,发送邮件就可以了。不过要保证你smtp服务器配置正确。 没有实际环境,我怎么给你写代码呢?其实很简单:比如:if ($_POST['submit']) //就是提交了表单{ .... //这里做你的一些事情,比如写入数据库之类的。 mail($to, $subject, $message, $headers); //调用mail函数,具体用法请参看手册吧} 和我一样啊!我昨天才看php,原来一直是作asp.net2.0,搞了一天了,郁闷死了,php和apache配置让人太郁闷!在线等 用PHPMAILER发吧。他的官方网站上面有例子。 这个可以用。我使用过的<?php// multiple recipients$to = '[email protected]' . ', '; // note the comma$to .= '[email protected]';// subject$subject = 'Birthday Reminders for August';// message$message = '<html><head> <title>Birthday Reminders for August</title></head><body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table></body></html>';// To send HTML mail, the Content-type header must be set$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";$headers .= 'Cc: [email protected]' . "\r\n";$headers .= 'Bcc: [email protected]' . "\r\n";// Mail itmail($to, $subject, $message, $headers);?> 楼上的不行,不能够很好的移植,通用性不强!经过一夜和一上午的奋战!!终于搞定!详情请看我的http://blog.csdn.net/lg836我正在编写中 DedeCms织梦团队-热诚邀请你的加盟 php 如何得到复选框所对应的值? 问个正则问题!~ 初学EXTJS+PHP,求助 关于iis6+php中iis信息服务管理器中路径设置问题 郁闷,session就是不能使用!!! 一个关于session的问题。新手上路。在线,很急。 为什么在有些php文件尾使用exit?ob_start是什么意思? 才听说的熔丝技术,请大家进来讨论. 急啊!!为什么从SQL Server 里面取出来的数据显示不出来? phpmailer 问题 用PHP怎么实现 动态画图 功能?
不过要保证你smtp服务器配置正确。
其实很简单:
比如:
if ($_POST['submit']) //就是提交了表单
{
.... //这里做你的一些事情,比如写入数据库之类的。
mail($to, $subject, $message, $headers); //调用mail函数,具体用法请参看手册吧}
在线等
<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';// subject
$subject = 'Birthday Reminders for August';// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";// Mail it
mail($to, $subject, $message, $headers);
?>
经过一夜和一上午的奋战!!终于搞定!
详情请看我的http://blog.csdn.net/lg836
我正在编写中