PHP mail() function not sending email and no error was reported

The problem was that mail() method worked when invoked with php -r "mail('address@domain.tld', 'Subject', 'Message'); but when I tried it via the web server (apache in my case), in a php script, no email was sent and the mail method returned false. On top of this no error was displayed or logged anywhere not even error_get_last function did not return anything and I had display_errors and error_reporting activated and full E_ALL.

After trying all┬áthe possible tests that I could imagine I tried to send an email by executing the sendmail command form a php script. When I tried php’s shell_exec with sendmail:


and checked apache’s error logs got the error sh: /usr/sbin/sendmail: Permission denied. After I got this error it was obvious that the fix was to change the permissions for /var/qmail/bin/qmail-inject and /var/qmail/bin/sendmail so that apache can execute them.

Then said to myself: Happy developing! and that was it.

NOQUEUE: reject: RCPT from unknown[]: 553 5.7.1 : Sender address rejected: not owned by user

This error was written in my maillog when I was trying to send an email with Thunderbird.

It seams that the reason for this error was the fact that I used on the outgoing server’s options a port number that was used for imap instead of the needed smtp server.

This error is really weird:

Mar 27 10:33:32 somehost postfix/smtpd[34322]: NOQUEUE: reject: RCPT from unknown[]: 553 5.7.1 : Sender address rejected: not owned by user; from= to= proto=ESMTP helo=

To fix this check out the outgoing server settings to have set the correct smtp port number.

Slow ssh and slow vsftpd login – Centos 6

The reason that the ssh commands were slow and sluggish (had to wait for seconds after enter was pressed to execute the command). There was nothing in the logs (that I could find) to help me identify this issue. I used google and many ideas from different forums without any luck.

I discovered that the changes I did to iptables some time before were wrong. Being a newbie I removed a rule that seamed suspicious (to me this rule looked too permissive):

ACCEPT all -- anywhere anywhere

To fix the issue I added the following rule back to my iptables. “This rule will allow all incoming packets destined for the localhost interface to be accepted.”

iptables -A INPUT -i lo -j ACCEPT