在网站上的联系表格和回复电子邮件 [英] php Contact Form on website and reply-to email

查看:178
本文介绍了在网站上的联系表格和回复电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Rapidweaver制作的中介网格服务器上绑定了一个站点上的PHP联系表单。除了它生成给我们的info@ourdomain.com的电子邮件以serveradmin@ourdomain.com的身份发送外,它运行良好。我认为服务器只是使用垃圾桶/黑洞地址。任何方式来调整我的PHP或更好的服务器设置,发送邮件作为回复地址,用户填写联系表单本身?



为什么?那么谷歌托管这个域名的电子邮件,我想用他们的罐头回应作为自动回复。当然,问题在于自动回复是serveradmin@ourdomain.com,而不是他填写在表单上的用户的电子邮件地址。



谢谢帮助!

-Hunter

解决方案

您的邮件

 <?php 
$ to ='nobody@example.com';
$ subject ='主题';
$ message ='hello';
$ headers ='发件人:webmaster@example.com'。 \r\\\

'回复:webmaster@example.com'。 \r\\\

'X-Mailer:PHP /'。 phpversion();

邮件($ to,$ subject,$ message,$ headers);
?>

参见 mail phpdoc


I have a PHP Contact form on a site I am hosing on our mediatemple grid server that was made with Rapidweaver. It works well except that the email it generates to our info@ourdomain.com is sent as serveradmin@ourdomain.com. I think the server is just using the trash/blackhole address. Any way to adjust my php or better yet, the server settings, to send the mail as the reply-to address that the user fills out on the contact form itself?

Why? Well Google hosts the email for this domain and I wanted to use their canned responses as an auto-responder. The problem of course, is that the auto-response goes to serveradmin@ourdomain.com and not the user's email address that he filled in on the form.

Thank you for the help!

-Hunter

解决方案

You can add headers to your mail

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

see mail phpdoc

这篇关于在网站上的联系表格和回复电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆