无法以我的PHP形式发送电子邮件

时间:2017-03-14 05:57:27

标签: php email smtp email-integration

我无法发送邮件。我想知道我做错了什么或如何连接到smtp。

这是我用于发送电子邮件的代码。

我错过了什么

$to='pratik.purohit@steeplap.com';
$subject='Hey';
$body='
This is a test email
';
$headers='From: pratik.purohit@steeplap.com';
if(mail($to, $subject, $body, $headers)){
echo 'mail send '.$to;
}
else{
echo "mail not send";
}

1 个答案:

答案 0 :(得分:0)

只需在@之前移除mail ()即可查看日志中的错误。

如果您想使用外部smtp服务器发送电子邮件,请使用PHPMailler库。