Jump to content
X2Community Forums

[Solved] 504 (Gateway Time-out) when sending emails


Recommended Posts

Hi,

 

I don't know what is happening but the server is hanging when trying "Send Test Email" on the marketing module. This is the error I'm seeing on chrome dev tools
"VM5899:1 POST http://dev.mycrm.com/index.php/marketing/inlineEmail?ajax=1&postReplace=1&contactFlag=1&skipEvent=1504 (Gateway Time-out)"

After this the server will hang until I restart php7.0-fpm and nginx services.

I don't have a clue why is this happening, before it was working ok.

Link to post
Share on other sites

What about when you send an individual email from a Contact view screen? Do you similarly receive the 504 timeout in that case? Are you using the legacy method or an SMTP account for sending? In the latter case, you might want to re-verify the settings for that email account under the "Manage Apps" page, accessible from the top-right user menu. Has the network configuration on the server been changed recently, possibly firewall rules? What version of X2CRM are you currently using, and when did you last update?

Link to post
Share on other sites

Hi X2Raymond,

"What about when you send an individual email from a Contact view screen?"
Yes, it happens the same.

I'm using an SMTP account from sendgrid for this, but iv also tried with a yahoo account and the same happen (cant even re-verify the credentials, as this will also make the server to hang and will timeout) I don't remember changing anything on the server from when it was working except for the server powering off for 1 day because of a downtime in the vps provider. 

As for the firewall UFW I have disabled it and problem persists.

 

The version used is 6.6 but it also happens with 6.5.2

I think unfortunately I will have to reinstall the vps, do you suggests a php version and a webserver in particular? should i use php 5.6 with apache or php7 with nginx is just as fine?

​Thanks

Link to post
Share on other sites

Interesting, it may be worth it to verify network connectivity regardless to ensure the configuration of the networking devices in between the servers isn't getting in the way. Try connecting to your email server from the server X2CRM is hosted on using a CLI utility like telnet, substituting your host and port as appropriate:

telnet smtp.googlemail.com 587
telnet imap.googlemail.com 993

If the connection succeeds, we can rule out network connectivity.

 

It will also be worth checking if the SSL CA certificates are up to date. You can try updating the ca-certificates package with your package manager, and can test the validity of these certs with a command like:

openssl s_client -connect smtp.googlemail.com:587 -CApath /etc/ssl/certs

which should return near the end of the output "Verify return code: 0 (ok)".

 

X2CRM is tested against PHP versions 5.3, 5.4, 5.5, 5.6, and 7.0. Both work well, but one caveat with nginx is that you will need to adjust your config to account for the rules in the .htaccess file intended for hosting under Apache.



			
		
Link to post
Share on other sites

Hi X2Raymond,

i've tried this as im using sendgrid and it wont connect

telnet smtp.sendgrid.net 587
Trying 119.81.43.3...
same with
telnet smtp.googlemail.com 587

and I'm using no ssl cert on this vps at the moment, as for the webserver I'm using nginx and php7 and no .htaccess equivalent on the nginx vhost, could you tell me what to use in nginx vhost?

Thanks

Edit: So it turned out seemingly is an issue in the vps provider i'm using (DO) which started blocking the port used by smtp. I guess I will try another VPS. 

Link to post
Share on other sites

Ahh interesting, I hadn't heard of similar issues in DO before. You may be able to find a suitable workaround in this related thread: https://www.digitalocean.com/community/questions/outgoing-connections-on-port-25-587-143-blocked-over-ipv6

 

Edit: Looks like they block SMTP on new accounts, so you may also be able to file a service case with DO to have your restriction lifted: https://cloud.digitalocean.com/support

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...