Reputation: 9
I have a .env file looks like this:
MAIL_MAILER='mailgun'
MAIL_HOST='smtp.mailgun.org'
MAIL_PORT=587
MAIL_ENCRYPTION='SSL'
MAIL_FROM_NAME="${APP_NAME}"
but i get this error when i want to send e-mails.
Connection could not be established with host "mailpit:1025": stream_socket_client(): php_network_getaddresses: getaddrinfo for mailpit failed:
what can i do to solve this problem?
I already change .env file but still got the same error.
Upvotes: 0
Views: 9469
Reputation: 41
If you tried Zafeer's answer and it still doesn't work, try changing MAIL_HOST from localhost to 0.0.0.0
Upvotes: -1
Reputation: 71
If you're using docker, let's ensure the mailhog container and laravel container are in same network bridge. Hope this helps.
Upvotes: 0
Reputation: 405
If you have windows system and you are not using laravel sail, then your mail config of .env file should look like this.
MAIL_MAILER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
open localhost:8025 on browser after running mailhog.exe as an admin.
you can install the same from below link
https://github.com/mailhog/MailHog/releases
Upvotes: 3