0

I have this mail class that is used to send an email after a user is manually verified in the admin backend. I copied the credentials from mailtrap.io into my .env file to test the mail but I got this log when the email class was invoked.

Swift_TransportException Connection could not be established with host mailhog: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: No such host is known.

Mailtrap credentials

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=secrete
MAIL_PASSWORD=secrete
MAIL_ENCRYPTION=tls
MAIL_FROM_NAME="${APP_NAME}"
matiaslauriti
  • 7,065
  • 4
  • 31
  • 43
  • Well, I am assuming you are using Laravel 8 because `MAIL_MAILER` is new on Laravel 8. So, it is the basic configuration `mailtrap` gives you. So the error is related to your host not finding the `mailtrap`'s host, like if there is a firewall or a wrong DNS... I am not 100% sure, but it is related to that. Are you running this in a docker container ? If so or not, can you run a `ping` to that host (run it in both container and normal please). If the ping is not responding, try `telnet smtp.mailtrap.io 2525`. – matiaslauriti Sep 05 '21 at 04:23
  • @matiaslauriti, it's on local host please. – mcClean Sep 05 '21 at 14:11

0 Answers0