为什么Laravel邮件在实时服务器上不起作用?

时间:2019-09-20 22:00:04

标签: php laravel laravel-6

我在Godaddy托管了一个主机。我写了一个电子邮件应用程序。它可以在本地主机上正常工作。我无法在托管上运行。当您输入其他服务器的smtp设置时,它仍然不起作用。我还阅读了以下主题。

Why mail laravel not working on the staging server?

Using Laravel, SMTP Mail not Working in Live Server

https://laracasts.com/discuss/channels/laravel/laravel-sending-mail-not-working-on-production-server

Connection could not be established with host mailtrap.io [php_network_getaddresses: getaddrinfo failed: No such host is known. #0]

MAIL_DRIVER=smtp
MAIL_HOST=mail.domain.org
MAIL_PORT=587
MAIL_USERNAME=user@domain.org
MAIL_PASSWORD=password
MAIL_ENCRYPTION=null

在我的本地主机上运行的设置。

Connection could not be established with host smtp.domain.org [php_network_getaddresses: getaddrinfo failed: Name or service not known #0]

当我给出500错误时,Godaddy的smtp设置。它不会产生任何错误。log

MAIL_DRIVER=mail

MAIL_DRIVER=sendmail

我通过查看其他链接尝试了它们。但我找不到解决办法。

1 个答案:

答案 0 :(得分:1)

不幸的是,您可能无法将外部邮件中继与共享主机一起使用。 https://www.godaddy.com/help/send-form-mail-using-an-smtp-relay-server-953

这些应该是GoDaddy本地主机设置:

### MAIL SERVER
MAIL_DRIVER=mail
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=user@domain.com
MAIL_FROM_NAME="Your Company"