7

I just installed php, mysql, nginx, sendmail on debian 6.

Now the PHP pages work fine. But when I try to use a simple mail() test:

Example: mail($to, $sub, $msg)

it takes too long to finish (around 30+secs) then get I 504 Gateway Time-out in my browser.

Funny thing is the email is actually sent.

BTW this is the error from the log: upstream timed out (110: Connection timed out) while reading response header from upstream

Anybody knows what's causing this error?

IMB
  • 15,163
  • 19
  • 82
  • 140
  • Did you find a solution for this? I see your question is from '12 but answers are from '14. Just thought I'd ask - I'm having the same problem. – Jbird Feb 24 '15 at 16:20

2 Answers2

1

I think the problem in your sendmail. I recommend to install Postfix instead of sendmail and configure it in php.ini. Then check your mail() function.

Also you can try to use sendmail directly instead of using mail- function.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Sergei Shitikov
  • 287
  • 2
  • 12
0

Sounds like a problem with the ability for php to contact the mail server. Have you verified the following:

Iptables is off (or any other firewall for that matter)

Display the contents of the following:

Sendmail cfg

and the output of the following command

netstat -punta (not calling you a name here ;) )

shdobxr
  • 111
  • 1
  • 10