我正在学习使用php发送电子邮件。我设法在macOS Mojave上使用XAMPP括弧,并且正在运行以下脚本
<?php
$emailTo = "me@mydomain.com";
$subject = "I hope this works!";
$body = "test simple email";
$headers = "From: me@mydomain.com";
if(mail($emailTo, $subject, $body, $headers)){
echo "Your message was sent, we\'ll get back to you ASAP!";
} else {
echo "Your message was not sent successfully.";
}
?>
导致以下结果:
Your message was not sent successfully.
我是这样做的初学者,我想我可能需要一些反馈。