【发布时间】:2015-08-18 23:08:51
【问题描述】:
我目前正在编写我的联系表脚本,每次填写我的联系表时,我都能完美地收到邮件,没有任何问题。电子邮件是这样的
发件人:noreply@domain.tld 和主题:联系表格提交。我想将 noreply@domain.tld 更改为我的公司名称......这样每次我收到邮件时,我都不会看到显示的电子邮件地址,而是看到我的公司名称。当然,回复功能必须保持活跃。有人可以帮帮我吗?
<?php
// Check if the form has been posted
if (isset($_POST['submit'])) {
// The email address the email will be sent to
$to = "xx@domain.pl";
// The email subject
$subject = "Contact Form Submission";
// Set the from and reply-to address for the email
$headers = "From: no-reply@xxx.pl\r\n"
. "X-Mailer: PHP/" . phpversion();
// Build the body of the email
$mailbody = "The contact form has been filled out.\n\n"
. "Name: " . $_POST['naam'] . "\n"
. "Email: " . $_POST['email'] . "\n"
. "Message:\n" . $_POST['vraag'];
// Send the email
mail($to, $subject, $mailbody, $headers);
// Go to the thank you page
header("location: thankyou.html");
exit;
}
【问题讨论】:
标签: php forms email-headers