[英]PHP mail script gives me syntax error
Im trying to get my php mailer embedded on my html page, I get no syntax errors in Dreamweaver but sendmail ( http://glob.com.au/sendmail/ ) keeps giving me this error message "Syntax error in arguments " Im hoping you can help me nail the issue 我试图让我的PHP邮件嵌入我的html页面,我在Dreamweaver中没有语法错误,但sendmail( http://glob.com.au/sendmail/ )一直给我这个错误消息“参数中的语法错误”我希望你可以帮我解决这个问题
My PHP mailer: 我的PHP邮件:
//Email information
$admin_email = "------------ Secret";
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$comment = $_REQUEST['comment'];
//send email
mail($admin_email, "$subject", $comment, "From:" . $email);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
Here is the relevant page code 这是相关的页面代码
<?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['email'])) {
//Email information
$admin_email = "schlichtingr@yahoo.com";
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$comment = $_REQUEST['comment'];
//send email
mail($admin_email, "$subject", $comment, "From:" . $email);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
<html>
<head>
</head>
<body>
<div id ="Email">
<form method="post"><br />
<h3><b>send us a message</b></h3>
<span>Any further questions or concerns? Send us an email!</span><br>
Email: <input name="email" type="text" /><br />
Subject: <input name="subject" type="text" /><br />
Message:<br />
<textarea name="comment" rows="15" cols="40"></textarea><br />
<input type="submit" value="Submit" />
</form>
</div>
<?php
}
?>
Any help you can give me would be much appreciated I am new to php but still trying to learn 你可以给我的任何帮助将非常感谢我是php的新手但仍在努力学习
Basically I just want to make a mail form built onto an html page 基本上我只是想在html页面上构建一个邮件表单
I'm not familiar with sendmail, but I notice 1 thing: 我不熟悉sendmail,但我注意到一件事:
"$subject"
needs to be just $subject
. "$subject"
需要只是$subject
。 You are capturing that variable for a reason. Hope this helps! 希望这可以帮助!
Try this code: 试试这段代码:
//if "email" variable is filled out, send email
if (isset($_REQUEST['email'])) {
//Email information
$admin_email = "user@example.com";
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$comment = $_REQUEST['comment'];
$headers = "From: $email" . "\r\n";
mail($admin_email, $subject, $comment, $headers);
//Email response
echo "Thank you for contacting us!";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.