这个问题在这里已有答案:
PHP邮件功能没有完成发送电子邮件 24个答案我有这个代码使用smtp发送电子邮件,我得到输出 - 使用以下代码成功发送邮件
ini_set('SMTP', 'mail.veshraj.com.np'); ini_set('smtp_port', 465); $message = "Hi \n How are you."; if(mail('veshraj.joshi1@gmail.com', 'Testing Subject for mail function', $message)) { echo 'Mail sent successfully'; }但我没有收到任何电子邮件,这个代码是在本地机器上; 如果在localhost中不支持smtp - 那么框架就像laravel,yii这样做了
This question already has an answer here:
PHP mail function doesn't complete sending of e-mail 27 answersI have this code to send email using smtp, and i got output- Mail sent successfully with following code
ini_set('SMTP', 'mail.veshraj.com.np'); ini_set('smtp_port', 465); $message = "Hi \n How are you."; if(mail('veshraj.joshi1@gmail.com', 'Testing Subject for mail function', $message)) { echo 'Mail sent successfully'; }But I did not receive any email, this code is in local machine; If smtp not supported in localhost - then how did frameworks like laravel,yii to do so
最满意答案
您是对的,您不能使用XAMMP在本地主机上发送邮件。 您需要在可以发送邮件的服务器上工作,例如EC2实例。 查看: https : //laravel.com/docs/5.0/mail ,了解他们如何配置邮件。
它们提供了如何将电子邮件发送到日志而不是收件人的信息。
You are right that you can't send mail on your local host with XAMMP. You need to work on a server that can send mail such as an EC2 instance. Check out: https://laravel.com/docs/5.0/mail and read about how they configure their mail.
They give information how how to send emails to logs instead of recipients as well.
更多推荐
发布评论