-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift Mailer via PHP CLI not sending hostname for e-mail #3216
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background (please complete the following information):
Describe the bug
A clear and concise description of what the bug is.
Please provide additional information too, depending on what you have issues with:
Panel:
php -v
(the php version in use). v7.4.16Daemon:
uname -a
anddocker info
(your kernel version and information regarding docker)I'm using Gmail to send out emails for Pterodactyl panel. I'm doing this via smtp-relay.gmail.com and testing via /admin/settings/mail works. When I create new accounts it doesn't send an e-mail to the recipients. Because I was worried that it could be a problem of them not receiving mail from my domain I also tried sending a password reset to myself but it did again not get to my inbox.
By digging a little further in the logs I got the following error: https://ptero.co/asexitufet.shell
I've searched for the error online and found that Google mail requires a sender hostname to be sent with the mail and php cli doesn't set $_SERVER["SERVER_NAME"] so it fails.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected behavoir is that the queue worker just sends the mail out.
Hacky temporary fix
While searching on the internet for this problem I saw that this is a known problem in Laravel Swift. A way to fix it is to add the line
$_SERVER["SERVER_NAME"] = "pterodactyl.domain.example"; //or gethostname()
(where pterodactyl.domain.example is your server name ofcourse)
to app/Providers/AppServiceProvider.php in the boot function. This sets your SERVER_NAME and thus Swift has a SERVER_NAME to send with the mail and Gmail SMTP accepts and sends the mail.
TL;DR
PHP CLI doesn't set $_SERVER["SERVER_NAME"] which causes sending mails with Gmail to fail via the Queue Workers.
The text was updated successfully, but these errors were encountered: