Mail from account web scripts ALWAYS rejected by gmail, yahoo. hotmail etc.

mitt

Member
May 11, 2004
22
0
151
Hi All,

I have one particular account which must be able to send mail from a php script.

Unfortunately the sending domain always displays as my WHM server's domain. As a result the mail is rejected by MANY email providers.

I have tried: Changing the Sending IP for Outbound Email in Exim implemented to a T and still all config mods i've made are ignored.

I have also tried setting the interface directly to the IP i want to mail to go out on (this PTR for the domain i set resolves to the correct domain i need to send mail from) and STILL the emails show as being sent from my WHM server's hostname which reverse DNS resolves to the main non-shared IP..

I am at a loss. It seems as though EXIM is ignoring all attempts to make changes. I have restarted exim for every attempt and still nothing seems to effect which ip/domain the mail is sent from.

I am positive many people knowingly or unknowingly are having sharedIP accounts mail being rejected by top domains because of this issue. Please HELP!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
If your PHP script is using the PHP mail() function or sendmail, exim is not used for sending the emails. In this instance, it is instead using sendmail, which bypasses the exim options and checks.

The script would need to be revised to use SMTP authentication instead of the PHP mail() function. When using SMTP to authenticate as a set user with a password, you should then be able to send using exim directly. If this does not work for sending the email with the correct domain name and IP, please provide a copy of the script for us to review.
 

mitt

Member
May 11, 2004
22
0
151
If your PHP script is using the PHP mail() function or sendmail, exim is not used for sending the emails. In this instance, it is instead using sendmail, which bypasses the exim options and checks.

The script would need to be revised to use SMTP authentication instead of the PHP mail() function. When using SMTP to authenticate as a set user with a password, you should then be able to send using exim directly. If this does not work for sending the email with the correct domain name and IP, please provide a copy of the script for us to review.

Hi Thanks for the reply. Well that explains why the php mail() version of the script was not looking at the EXIM settings.

Now i am trying to use SMTP auth and i am unable to connect to the server. I would guess there are some security settings blocking maybe user accounts on the localhost from authenticating? Any ideas why my script wouldn't be able to connect? Thanks!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Are you using CSF on the machine? If so, can you ensure SMTP isn't blocked for localhost for users authenticating that way? The settings you'd check would be SMTP_BLOCK and SMTP_ALLOWLOCAL ones.
 

mitt

Member
May 11, 2004
22
0
151
Specifically, the connection times out. But i can use the exact same settings in a mail reader (firebird, outlook etc) and it works fine. Same acct, password, domain....
 

mitt

Member
May 11, 2004
22
0
151
I've tried changing these but specifically what should they be set to? Both to 0? I am not using SMTP Tweak (disabled)
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
They should both be set to 0 during the troubleshooting process. If that does work, then change both to 1 after that point to see if it still works. If it doesn't, you'll have no choice but to keep them at 0 (disabled).
 

mitt

Member
May 11, 2004
22
0
151
Working now. Thanks, i set both SMTP_BLOCK and SMTP_ALLOWLOCAL to 0 (any security implications i should think about?) and working fine now.

But this is what the header looks like:

from frxxxxxt.ca ([66.207.198.77] helo=66.207.xxx.xxx)
by sparky.xxxxxxxx.com with esmtpa (Exim 4.69)

There is a PTR for 66.207.xxx.xxx which resolves to frxxxxxt.ca.. how do i get rid of the 'by sparky.xxxxxxxx.com'??

Thanks a ton!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Is the following set in WHM > Exim Configuration Editor area?

Set the Sender: Header when the mail sender changes the sender (-f flag passed to sendmail). [?]

Always set the "Sender:" header when the sender differs from the actual sender. Unchecking this will stop "On behalf of" data in Microsoft® Outlook, but may limit your ability to track abuse of the mail system.
If that is set to "On" then change it to "Off"
 

mitt

Member
May 11, 2004
22
0
151
Hi Tristan thanks for all your help. Doesn't seem to be an issue as all the domains that were rejecting mail before this all started are now accepting mail from this script, which is great news. So thanks again!