• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

PHP-generated emails are blocked

T

thedust2010

Guest
We recently obtained a server with Plesk 7.5 Reloaded on it. We've made a few customizations, but nothing much. Certainly nothing to qmail. However, we've discovered that any email and mailed out of PHP (using the PHP function mail()) are getting completely blocked. They don't show up anywhere. They never get to their inboxes. I've done some searching on this subject but have not found anything on it. This is extremely troublesome for us and we need to get this remedied right away. Any suggestions as to what we can do??

NOTE: I have tested sending to outside yahoo and hotmail addresses and the forms are working with no problems.
 
Have you checked your /usr/local/psa/var/log/maillog for any error indications, or signs that the emails were processed at all?

In your PHP scripts, are you using 'sendmail' or trying to send directly to qmail binary?

There should be a Qmail replacement for sendmail in /usr/sbin/sendmail which is so standard form mail will work without having to tweak things specifically for Qmail-inject
 
I can verify by looking at the mail logs that the emails are NOT being processed at all.

I found one PHP configuration issue which might be the problem but I'm not sure...

$_ENV["MAIL"] is set to /var/spool/mail/root.

That is more than likely overriding sendmail, which PHP is set up by default to work with.

I am guessing it is out of the question to try and use sendmail. Is /var/spool/mail/root part of qmail? On this point, I am a bit confused.
 
PHP should be using the sendmail binary. Note that qmail itself provides a sendmail binary, which is a wrapper for qmail-inject.

All you should need in your PHP configuration is this line in php.ini: "sendmail_path = /usr/sbin/sendmail -t -i"

You should check the presence of /var/qmail/bin/sendmail, which is where the symlink /usr/sbin/sendmail points to.

You can also use "rpm -V psa-qmail".

Also, make sure the php-imap package is correctly installed, otherwise mail() won't work.

You can disregard the MAIL env var. /var/spool/mail/root is not used by qmail, in fact, qmail does not delivery mail to root, you have to create an alias and forward it elsewhere, but that has nothing to do with your problem.
 
According to phpinfo(), sendmail_path is already set to:

/usr/sbin/sendmail -t -i

I think the php-imap package is installed correctly, but I'm drawing this assumption once again from phpinfo(). Under "imap", my settings read:

IMAP c-Client Version 2001
SSL Support enabled
Kerberos Support enabled

So everything appears like it should be working... this is going to drive me crazy.
 
Let me see if I have the facts straight:

1) Using your form, you can send to the outside world ([email protected], [email protected]) So sendmail and mail() are working, and are obviously not the problem. If they were not working, you would not be able to send to the outside.

2) Using the same form, you cannot send to a local user's mailbox. Nothing in /usr/local/psa/var/log/maillog shows that these emails are even processed at all.

3) When trying to send to a local mailbox, you are putting the full email address ([email protected]), not just the username 'zzz', right?
 
Those facts are all correct. However, the PHP form could be located anywhere on the Internet and it still won't deliver to our mailboxes. It is not just one PHP form either, but one of any of the dozens of forms that we've built for clients.
 
So it's sending mail TO your server from either a form located on your server, or on another server? Are you sure the MX records for the domain are correct? Are you sure there's nothing shows in the maillog.

Is this a VPS?
 
We are not receiving any email from any PHP form anywhere on the internet. We can send from PHP forms on our server just fine, but only to outside email boxes.

This is not a VPS. It is a dedicated server.

I have tried taking off all MAPS and SpamAssassin blocking and still no results. I will check the mail logs again, but I am fairly confident that the emails are not being processed.
 
OK... we got this problem solved. It turned out the forms we were testing were indeed on the same server. We thought we had changed the DNS for one of those domains and it was not the case. The reason we didn't get any PHP-generated emails was because the domain it was sending to was still set up on that server (we moved it over from that server to another).

Problem solved. Thank you very very much for your helpful troubleshooting advice. I think getting Plesk was the best choice we've made yet. cPanel just doesn't compare.
 
Back
Top