我想在电子邮件正文中的电子邮件表单中添加“此邮件来自etcetc.com”。希望这有意义..
my sent_email.php
<?php
$email_to = 'test@test.org';
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$headers = 'From: ' . $name . ' <' . $email . '>' . "\r\n" . 'Reply-To: ' . $email;
if(mail($email_to, $subject, $message, $headers)) {
echo 'sent'; // we are sending this text to the ajax request telling it that the mail is sent..
} else {
echo 'failed'; // ... or this one to tell it that it wasn't sent
}
&GT;
答案 0 :(得分:0)
您需要做的就是将文字添加到$message
的末尾。
变化:
$message = $_POST['message'];
到
$message = $_POST['message'] . "\n\nThis message came from etcetc.com";
答案 1 :(得分:0)
像这样:
<?php
$email_to = 'test@test.org';
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = "This message came from etcetc.com \r\n".$_POST['message'];
$headers = 'From: ' . $name . ' <' . $email . '>' . "\r\n" . 'Reply-To: ' . $email;
if(mail($email_to, $subject, $message, $headers)) {
echo 'sent'; // we are sending this text to the ajax request telling it that the mail is sent..
} else {
echo 'failed'; // ... or this one to tell it that it wasn't sent
}
?>
答案 2 :(得分:0)
根据需要在
之前和之后添加消息$message = "This is before posted message\r\n";
$message .= $_POST["message"];
$message .= "\r\nthis is after the posted message";