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

vmutius's avatar

Connection could not be established with host "ssl://mail.privateemail.com:465":

I have a problem sending out mails through privatemail from namecheap. Everythings worked till two days ago. I added a new controller inside the webpage to generate some reports, but did not change anythink which should influence mail sending stuff.

Connection could not be established with host "ssl://mail.privateemail.com:465": stream_socket_client(): Unable to connect to ssl://mail.privateemail.com:465 (Connection timed out)

Can anybody point me in the right direction? I have no idea where to look.

Thanks

0 likes
3 replies
LaryAI's avatar
Level 58

The error message you're encountering indicates that your application is unable to establish a connection to the SMTP server at mail.privateemail.com on port 465 using SSL. Here are some steps you can take to troubleshoot and resolve this issue:

  1. Check Network Connectivity:

    • Ensure that your server or local environment has internet access and can reach mail.privateemail.com. You can test this by using a command like ping or telnet from your server:
      telnet mail.privateemail.com 465
      
    • If the connection times out, there might be a network issue or firewall blocking the connection.
  2. Verify SMTP Configuration:

    • Double-check your SMTP configuration settings in your application. Ensure that the host, port, username, and password are correct.
    • Example configuration in a .env file for a Laravel application:
      MAIL_MAILER=smtp
      MAIL_HOST=mail.privateemail.com
      MAIL_PORT=465
      [email protected]
      MAIL_PASSWORD=your-email-password
      MAIL_ENCRYPTION=ssl
      
  3. Firewall and Security Groups:

    • If you're hosting on a cloud provider (like AWS, DigitalOcean, etc.), ensure that the security groups or firewall rules allow outbound connections on port 465.
  4. SSL/TLS Configuration:

    • Ensure that your application is configured to use SSL for the connection. In Laravel, this is typically set with MAIL_ENCRYPTION=ssl.
  5. Check for Service Outages:

    • Verify with Namecheap if there are any ongoing issues or maintenance activities affecting their email services.
  6. Review Recent Changes:

    • Since you mentioned adding a new controller, review any recent changes to ensure they haven't inadvertently affected your mail configuration or network settings.
  7. Logs and Error Messages:

    • Check your application logs for any additional error messages that might provide more context.
  8. Test with a Different Email Client:

    • Try sending an email using a different client (like an email client on your computer) with the same SMTP settings to see if the issue is specific to your application.

By following these steps, you should be able to identify and resolve the issue with your SMTP connection. If the problem persists, consider reaching out to Namecheap support for further assistance.

vmutius's avatar

OK, the problem seems not be with my code, since I can establish the connect via "telnet mail.privateemail.com 465" on my machine, but when I run it on the digitalocean server I am not able to connect.

Again really confused since it stoped working all of a sudden. Any ideas what I should do? What do I need to check and change on digitalocean?

CorCronje's avatar

I have the same challenge, it appears DigitalOcean block common SMTP ports, except for 2525. I was able to connect to smtp.mailersend.net on port 2525 and could relay email before running into an authentication issue.

You can read more here: https://docs.digitalocean.com/support/why-is-smtp-blocked/

We should probably drop SMTP and use APIs instead.

1 like

Please or to participate in this conversation.