Google offers an excellent free email service to website owners where they can use custom domain names (yourchoice@yourdomain.com) to offer full-fledged Gmail styled email service with personal customization's and branding to their users.
To use Google's SMTP servers for sending emails, webmasters must configure there servers and application/scripts to use it instead of the default SMTP server configured on the system. While configuring the same for this drupal blog using SMTP Authentication Support Module, the following errors were shown resulting in repeated failures.
Warning: fsockopen() [function.fsockopen]:
unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in SMTP->Connect()
To use Google's SMTP services make sure you have following taken care off :
- Using following settings to configure email sending.
- Have OpenSSL support installed for PHP (if using PHP, otherwise framework you are using).
- And finally the reason for errors above - proper permissions in your firewall. In my CentOS installation using the command below at terminal solved the issue:
iptables -I OUTPUT -p tcp --dport 465 -j ACCEPT
iptables -I OUTPUT -p tcp --dport 587 -j ACCEPT
If you have other firewall like CSF, make sure to white-list outgoing TCP ports 465 and 587 through them. In Config Server Firewall (CSF) this can be done by editing /etc/csf/csf.conf and adding these ports in TCP_IN and TCP_OUT, followed by a firewall restart using csf -r.
Add new comment