[Update]
I've tried using wamp on windows and still can't connect to smtp.mailtrap.io
I have this homestead.yml config for ports
keys:
- ~/.ssh/id_rsa
ports:
- send: 587
to: 587
- send: 2525
to: 2525
protocol: tcp
folders:
- map: C:/code
to: /home/vagrant/code
And this .env config
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=xxxx
MAIL_PASSWORD=xxxx
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"
But I always get
{"error_code":400,"status":"error","message":"","data":"Connection could not be established with host smtp.mailtrap.io
:stream_socket_client(): unable to connect to smtp.mailtrap.io:587 (Connection timed out)"}
I tried SendGrid
too with ports 587
and 2525
but I always get the same message. I tried to connect to mailtrap from ssh
telnet mailtrap.io 587
telnet mailtrap.io 2525
Also tried this from SSH
sudo ufw allow 25/tcp
sudo ufw allow 2525/tcp
sudo ufw allow 587/tcp
But in both cases I don't get any response. I tried to change MAIL_ENCRYPTION
to tls
but didn't work too.
While starting vagrant I get only these port forwardings
==> homestead: Forwarding ports...
homestead: 80 (guest) => 8000 (host) (adapter 1)
homestead: 443 (guest) => 44300 (host) (adapter 1)
homestead: 3306 (guest) => 33060 (host) (adapter 1)
homestead: 4040 (guest) => 4040 (host) (adapter 1)
homestead: 5432 (guest) => 54320 (host) (adapter 1)
homestead: 8025 (guest) => 8025 (host) (adapter 1)
homestead: 9600 (guest) => 9600 (host) (adapter 1)
homestead: 27017 (guest) => 27017 (host) (adapter 1)
homestead: 22 (guest) => 2222 (host) (adapter 1)
How can I connect successfully to mailtrap from Laravel on Homestead?
I tried using VPN then tried
telnet
and it worked find and emails got sent so it wasn't any coding or cache issue it was related to connection and closed services or ports solved by using VPN