-1

我想在电子邮件正文本身的电子邮件表单中添加“此消息来自 etcetc.com”。希望这有意义..

我的 send_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    
}

?>

4

3 回答 3

0

您需要做的就是将文本添加到$message.

改变:

$message = $_POST['message'];

$message = $_POST['message'] . "\n\nThis message came from etcetc.com";

于 2013-09-30T17:46:49.087 回答
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    
}
?>
于 2013-09-30T17:49:41.163 回答
0

根据需要在之前和之后添加消息

$message = "This is before posted message\r\n";
$message .= $_POST["message"];
$message .= "\r\nthis is after the posted message";
于 2013-09-30T17:52:04.223 回答