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

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

问题描述

我在使用 Rapidweaver 制作的 mediatemple 网格服务器上的网站上有一个 PHP 联系表单.它运行良好,只是它生成到我们的 info@ourdomain.com 的电子邮件是作为 serveradmin@ourdomain.com 发送的.我认为服务器只是使用垃圾/黑洞地址.有什么方法可以调整我的 php 或更好的服务器设置,将邮件作为用户在联系表单本身填写的回复地址发送?

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?

为什么?好吧,谷歌托管了这个域的电子邮件,我想用他们的预设回复作为自动回复.当然,问题是自动回复发送到 serveradmin@ourdomain.com,而不是他在表单上填写的用户电子邮件地址.

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.

感谢您的帮助!

-猎人

推荐答案

您可以在邮件中添加标题

You can add headers to your mail

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

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

请参阅 邮件 phpdoc

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

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