504 error, Please help

504 error was returned on browser while trying to sent a mail via phpmailer, I've adjusted the priority of the ipv4 and ipv6 yet i get the same 504 gateway runtime error. please what else can I do to use phpmailer on my website, the website uses apache on centos 8.

I've been trying to solve this problem for days. I've searched and tried to fix the issue as much as I could, yet I get same errors. your response will be greatly appreciated. thanks.

7 Replies

Is this a new system? If so your mail ports, may be blocked and PHPMailer can't send mail. To unblock the ports, you need to file a support ticket and ask Linode to do that.

You say in your other post that your system is "an SMTP host"… Is your mail server working correctly? Can you send mail without PHPMailer (like with mailx(1))? If you're using a 3rd-party mail server (like Gmail), does your outbound mail meet the operator's requirements with respect to SPF, DKIM, DMARC, etc?

What does "…I've adjusted the priority of the ipv4 and ipv6…" mean? Try IPv4 and fall back to IPv6?

-- sw

Hey there -

I've been doing some research as well for you on this, and I found a few resources that hopefully will help you out.

I know you've done some research on this yourself, and it's not my intention to provide you with resources you've already found, but I wanted to provide you those that look to me like they'd be the most helpful.

I found this on Stack Overflow, which discusses this error as it relates to sending mail with PHP:

Sent Mail in PHP throw 504 Gateway Time-out

This page suggests it's the result of the way your /etc/hosts file is configured:

Mail sends fine but returning 504 error

I hope these help you out. Feel free to report any successes or failures in this thread so that the Linode Community can continue to assist.

[@stevewi] (/community/user/stevewi) Yes, it is a new system and I can't send mail with php mail() function either, I also get a 504 timeout error with that as well. I use a 3rd party mail server and I am not sure if it meets the requirements with respect to what you have mentioned, how do I checked that?

@rgerke I've gone through the thread and suggestions where given to use phpmailer which i'm already using. The issue might be that the mail ports have been blocked as the response above mentioned. So I've filed a support ticket to this effect, hopefully I should get a response soon. thanks.

@rgerke my hosts is properly configure as well, I still get the same 504 gateway timeout.

@tundebrown101 --

SPF, DKIM and DMARC info are all stored in DNS TXT records. Linode does not create them for you…you have to create them yourself.

See:

https://www.linode.com/docs/networking/dns/dns-records-an-introduction/

https://www.endpoint.com/blog/2014/04/15/spf-dkim-and-dmarc-brief-explanation

Unfortunately, Linode doesn't offer a "guide" about this. Perhaps contacting support will yield some help for you.

-- sw

@stevewi thank you very much for your response, linode support team have responded to my ticket, the restrictions on my account have been lifted. I no longer get a 504 gateway timeout and emails sent successfully.

So to those that might be facing similar issues, my account is new and by default linode sets restrictions on new accounts pertaining mails, mail ports are blocked on new accounts. All I did was file a support ticket and the restrictions were lifted. I hope this helps.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct