• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Email to [EMAIL] failed (after retry): Could not open socket - library/Zend/Mail/Protocol/Abstract.php:277

#1
Hello,

Late last night I finished migrating my forums from a shared environment (SiteGround) to my own VPS (OVH). This morning, I woke up to 28 server errors all for the same issue. This is obviously caused by something which is misconfigured. Is it possible for someone to recommend a fix to me? I am using Centos 6.9 with the latest version of cPanel, and I use Google Apps to send emails via SMPT.

Here is a copy of the error details:
Code:
Error Info
Zend_Mail_Protocol_Exception: Email to [EMAIL] failed (after retry): Could not open socket - library/Zend/Mail/Protocol/Abstract.php:277
Generated By: Unknown Account, 9 minutes ago
Stack Trace
#0 /home/crimecoa/public_html/library/Zend/Mail/Protocol/Smtp.php(167): Zend_Mail_Protocol_Abstract->_connect('ssl://smtp.gmai...')
#1 /home/crimecoa/public_html/library/Zend/Mail/Transport/Smtp.php(216): Zend_Mail_Protocol_Smtp->connect()
#2 /home/crimecoa/public_html/library/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#3 /home/crimecoa/public_html/library/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#4 /home/crimecoa/public_html/library/XenForo/Model/MailQueue.php(91): Zend_Mail->send(Object(Zend_Mail_Transport_Smtp))
#5 /home/crimecoa/public_html/library/XenForo/Deferred/MailQueue.php(10): XenForo_Model_MailQueue->runMailQueue(7.9999990463257)
#6 /home/crimecoa/public_html/library/XenForo/Model/Deferred.php(295): XenForo_Deferred_MailQueue->execute(Array, Array, 7.9999990463257, '')
#7 /home/crimecoa/public_html/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 7.9999990463257, '', false)
#8 /home/crimecoa/public_html/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#9 /home/crimecoa/public_html/deferred.php(23): XenForo_Model_Deferred->run(false)
#10 {main}
Request State
array(3) {
  ["url"] => string(45) "https://www.crimecoastforums.com/deferred.php"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(4) {
    ["_xfRequestUri"] => string(18) "/threads/new.4210/"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}
Thank you in advance for any help.

Regards,
Carl
 
#3
Check that you don't have a firewall blocking the outbound port you are using to connect to Gmail with.
Thank you for your help. I double checked the port was open using the following commands, but still no joy:
Code:
sudo iptables -A INPUT -m state --state NEW -p tcp --dport 25 -j ACCEPT
sudo iptables -A INPUT -m state --state NEW -p tcp --dport 465 -j ACCEPT
sudo iptables -A INPUT -m state --state NEW -p tcp --dport 587 -j ACCEPT
Can you suggest any other fixes, please? I have been working on this for over a week and I am still no further with it :|
 
#5
I have this working now. Just in case anyone else has this issue here is the problem and the solution.

So, when I moved from a shared environment to a VPS, I just changed my A record at GoDaddy to point at my new server's IP address so I didn't have to worry about the DNS, as many guides said to do. The problem with this is Google was expecting the emails to come from GoDaddy's network and IP address, but it was being sent from my VPS's IP and network, so they automatically rejected the email. Google seen it as another user was trying to pretend to be me and send spam as if it was coming from my domain.

The only way I could fix this was to set up and manage my own DNS, and change the nameservers to the ones setup on my VPS

That is how I understand it anyway. It make be a lot deeper than that, and it may be possible to solve in a different way.

If anyone is having any issues or questions regarding moving from a shared environment to a VPS, feel free to message me. I am no expert, but I can perhaps help with something you are unsure or stuck with.
 
#6
Can someone explain this to me? I just migrated to GoDaddy and use gmail to send my emails and am getting the same error. Everything worked just fine before the change to the new server. I'm not sure what to change on my end....
 

Attachments