Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ayub01zero's avatar

Laravel Mail Timeout Issue in Production

Laravel Mail Timeout Issue in Production (mail.privateemail.com on DigitalOcean via Forge) I'm running a Laravel application that I deployed to a DigitalOcean droplet using Laravel Forge. Email works perfectly in my local environment, but in production, I'm encountering a connection timeout when trying to send emails.

Here are my mail settings from the .env file on the production server: MAIL_MAILER=smtp MAIL_HOST=mail.privateemail.com MAIL_PORT=587 MAIL_USERNAME=[email protected] MAIL_PASSWORD=******** MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=[email protected] MAIL_FROM_NAME="${APP_NAME}"

the error log

production.ERROR: Connection could not be established with host "mail.privateemail.com:587": stream_socket_client(): Unable to connect to mail.privateemail.com:587 (Connection timed out)

What I’ve tried: Confirmed that the same settings work on my local machine.

Verified the credentials and mail host are correct.

Allowed outbound connections on port 587 from the Forge Network tab (firewall settings).

Tested other ports like 465 (ssl) but still no success.

Question: Why is this connection timing out only in production? Is there something specific I should check on DigitalOcean, Laravel Forge, or with privateemail.com?

0 likes
3 replies
jjoek's avatar

@ayub01zero

This could be a firewall issue: Confirm that your server is able to connect to the given host via that port.

telnet mail.privateemail.com 587

If this timeout, you may need to update your firewalls or network level settings to allow the given smtp connection

ayub01zero's avatar

@jjoek i know what is issue it was digitalocean because it is block port 25 587 and 465 in all droplet and you cant ublock it so i choose the other mail provider like resend and mailgun

Musab_Ur_Rehman's avatar

@ayub01zero hello brother, im gettinng the same issue for mailtrap on laravel forge deployment, could you please guide me with the process for configuring mail gun? that would be very very much appreciated

Please or to participate in this conversation.