我的联系表格有问题,请不要发送。不幸的是,我对我的服务器提供商的PHP Bellow回答不友好。
“感谢您与我们联系。我想通知您,联系表单显示发件人的电子邮件地址(应显示在服务器home.pl中创建的电子邮件地址): 30.08.2014 12:49:26 [/ usr / run / smtp] socket / plain(php5:xxxx.com/form/contact.php [1 work] DOCUMENT_ROOT = / SCRIPT_FILENAME = / form / contact.php)[serwer111111]一塌糊涂:e72823aae943c292 1108从:[magda.serwer111111]到:[magda.serwer111111]状态:LOCAL ERROR 554 5.7.1伪造的发件人地址:
此外,默认电子邮件地址字段THIS:的管理由无效值补充(变量不能替代正确的值): 30.08.2014 12:49:26 [/ usr / run / smtp] socket / plain(php5:xxxx.com/form/contact.php [1 work] DOCUMENT_ROOT = / SCRIPT_FILENAME = / form / contact.php)[serwer111111] mess:bf5e99f8a1316c4b 703 from:[serwer111111] to:[] status:REMOTE OK [0830124926_FE40E30F]
这是我的联系表格:
<?php
$receiving_email_address = "zydol@xxxx.com"; // Set your email address here which you want to receive emails to
$receiving_email_address_name = "Zydol"; // Add name that is associated with your email address above.
$custom_subject = "email from xxxx.com"; // Change the subject line of email as per your choice.
// ============================= DO NOT EDIT BELOW THIS LINE ======================================
if ((isset($_POST['name'])) && (strlen(trim($_POST['name'])) > 0)) { $name = stripslashes(strip_tags($_POST['name'])); } else {$name = 'No name entered';}
if ((isset($_POST['phone'])) && (strlen(trim($_POST['phone'])) > 0)) { $phone = stripslashes(strip_tags($_POST['phone'])); } else {$phone = 'No phone entered';}
if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) { $email = stripslashes(strip_tags($_POST['email'])); } else {$email = 'No email entered';}
if ((isset($_POST['datetimepicker'])) && (strlen(trim($_POST['datetimepicker'])) > 0)) { $datetimepicker = stripslashes(strip_tags($_POST['datetimepicker'])); } else {$datetimepicker = 'No email entered';}
if ((isset($_POST['comment'])) && (strlen(trim($_POST['comment'])) > 0)) { $comment = stripslashes(strip_tags($_POST['comment'])); } else {$phone = 'No comment entered';} ob_start();
// Email Building
$to = $receiving_email_address;
$email = $_POST['email'];
$fromaddress = $_POST['email'];
$fromname = $_POST['name'];
$body = "Below are the details submitted by the user on your website.
Name: ".$_POST['name']."
Email: ".$_POST['email']."
Phone: ".$_POST['phone']."
Date & Time: ".$_POST['datetimepicker']."
Comment: ".$_POST['comment']."";
// Check if the security is filled
if ( $_POST['security'] == '' ) {
require("phpmailer.php");
$mail = new PHPMailer();
$mail->From = "$email";
$mail->FromName = "$fromname";
$mail->AddAddress("$receiving_email_address","$receiving_email_address_name");
$mail->IsHTML(true);
$mail->Subject = "$custom_subject";
$mail->Body = $body;
$mail->AltBody = "This is the text-only body";
if(!$mail->Send()) {
$recipient = '$receiving_email_address';
$subject = 'Contact form failed';
$content = $body;
// Send Mail
mail($recipient, $subject, $content, "From: $receiving_email_address\r\nReply-To: $email\r\nX-Mailer: DT_formmail");
exit;
}
} ?>
有人能帮助我吗? 先感谢您 Zydol
答案 0 :(得分:1)
第一条消息是因为您设置了$email
添加行
$email = $_POST['email'];