第一个没有$ _Post的代码有效,第二个没有$ _POST的代码有效。它在cpanel的服务器上。有什么帮助:)
我尝试了各种操作,例如更改HTML中的代码,放置斜杠,还使用$ _request而不是$ _post。
这有效-
$to_email = "example@example.hr";
$subject = "Simple Email Test via PHP";
$body = "Hi,nn This is test email send by PHP Script";
$headers = "From: me@example.hr";
if ( mail($to_email, $subject, $body, $headers)){
echo("Email successfully sent to $to_email...");
} else {
echo("Email sending failed...");
}
$to_email = "example@example.hr";
$subject = "Simple Email Test via PHP";
$body = "Poruka:$_POST[poruka]";
$headers = "From: $_POST[email]\n";
if ( mail($to_email, $subject, $body, $headers)){
echo("Email successfully sent to $to_email...");
} else {
echo("Email sending failed...");
}
</code></pre>
第一个代码发送电子邮件,而第二个代码回显(“电子邮件发送失败...”)