我遇到了我的PHP代碼問題。我使用IF-ELSE來檢查一切正常,但它一直給我「你沒有輸入收件人」。發送郵件[PHP]
<?php
$to=trim($_POST['toperson']);
$from=trim($_POST['spoofrom']);
$message=trim($_POST['message']);
$subject=trim($_POST['subj']);
if (substr_count($to, '@') <= 1) {
if (!isset($to)) {
if (!isset($from)) {
if (!isset($subject)) {
if (!isset($message)) {
mail($to, $subject, $message, "From: " . $from);
print "Message was sent!";
}else {print "You did not enter a message";}
}else {print "You did not enter a subject";}
}else {print "You did not enter a from email";}
}else {print "You did not enter a recipient";}
}else{print "You entered 2 or more emails.";}
?>
您是否在表單中檢查收件人的文本框名稱?也許這是錯誤的。 – zkanoca 2013-04-06 12:09:56
請了解郵件標題注入。 – 2013-04-06 12:10:39