我的 PHP 代码有问题。我使用 IF-ELSE 检查一切是否正常,但它一直给我“您没有输入收件人”。
<?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.";}
?>