PHP脚本在自动回复电子邮件中没有显示我的电子邮件地址,而是显示网络托管公司


PHP script not showing my email address in auto reply email, but showing web hosting company instead

我刚开始创建网站,很抱歉以前有人问过我这个问题。我试着找到答案,但我似乎无法为我的具体问题找到答案。我已经在我的网站上为我的联系人表单创建了一个PHP脚本。我想在这个脚本中添加一个自动回复程序,这样提交表格的人就会收到一封确认/感谢电子邮件。我遇到的问题是找到正确的代码,这样我的电子邮件地址就会显示在自动回复电子邮件的顶部(发件人字段)。目前,顶部显示的电子邮件地址(发件人字段)是我的网络托管公司(iPage)的某个奇怪地址,而不是我的电子邮件地址。

这是我用来生成自动回复的代码。然而,我想知道,我必须添加什么才能使我的电子邮件显示在自动回复电子邮件的发件人字段中?

/* Prepare autoresponder subject */
$respond_subject = "Email Confirmation";
/* Prepare autoresponder message */
$respond_message =
"Thank you for contacting jadesambrook.com!
We will do our best to answer your email as quickly as possible.
Best regards,
www.jadesambrook.com";
/* Send the message using mail() function */
mail($email, $respond_subject, $respond_message);

您需要设置标题,请查看此处:

http://php.net/manual/en/function.mail.php

<?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);
?>
相关文章: