remote email server

kazaa

Member
Apr 11, 2006
11
2
153
Hi I am having trouble with sending emails.

I have 2 servers set up. Server A is used for webhosting and server B is used as an email server for all the domains that are setup on server A. Both servers are using cpanel.

I can connect to server B using smtp from home or anywhere else really and I can see in the logs that server B handles the emails just fine. Emails get sent and received just fine in that case.

But when I send an email from my website which is hosted on server A, server A is somehow delivering the emails. So when I send an email to [email protected] using php, server A attempts to deliver the message but it fails with "REJECTED - Bad HELO - Host impersonating [mydomain.com]"

I have dns for all domains on Server A set up as "Remote Mail Exchanger" but the server still attempts to send all mail that is sent directly from my websites.

I should mention that I am using phpmailer class to send emails using smtp from my websites and prior to december 26th everything was working fine. I set this up sometime in August.

HOpe you guys can help.
Thanks
 
Last edited:

Greenhost

Well-Known Member
Jan 22, 2013
92
0
6
cPanel Access Level
Root Administrator
Have you set your php.ini as SMTP?
If so, no it is not. to check/change your PHP mail configuration:

1. Open your php.ini file (if you don't know where this is, see below)
2. Search for the line that reads [mail function]
3. Add/change the details of your mail server. This could be a local mail server or the mail server of your ISP.
4. Save/close the php.ini file
5. Restart your web server

Here's a code you should set on php.ini file:
Code:
[mail function]
sendmail_path = Server B IP;
 
Last edited:

kazaa

Member
Apr 11, 2006
11
2
153
Thanks for your suggestion greenhost, I tried it but it made no difference.
 

kazaa

Member
Apr 11, 2006
11
2
153
Little more info.
My MX record is setup as mail.mydomain.com, mail.mydomain.com's A record points to the ip address of Server B. Like I said this setup had worked for a few months prior to Dec 26.
 

Greenhost

Well-Known Member
Jan 22, 2013
92
0
6
cPanel Access Level
Root Administrator
Little more info.
My MX record is setup as mail.mydomain.com, mail.mydomain.com's A record points to the ip address of Server B. Like I said this setup had worked for a few months prior to Dec 26.
It's a little complicated, if your MX, and php mail configuration -as smtp setting not mail setting- is setup normal y, it must be work. :confused:
Check your mail log in cPanel, if you couldn't find anything shear here. It will be helpful. ;)
that I'm aware of.
 
Last edited:

max_payne

Active Member
Feb 1, 2013
33
1
6
cPanel Access Level
Root Administrator
Have you tried viewing the mail logs for more information:

On server A, run the following as you fill out the form that sends emails:

tail -f /var/log/exim_mainlog

Normally mail sending scripts will send from the server itself. The sending email address will look something like [email protected], unless the script itself has SMTP authentication enabled and is sending from a real email address instead. I suspect your web server (server A) was sending these emails all along.

See if the logs provide you with any further information besides the 'REJECTED - Bad HELO - Host impersonating' message. I also suggest deleting DNS zone files on the server they are not live on just to avoid conflict. Next, look at your /etc/resolv.conf file to see if it looks okay. I have seen this file get 'reset' after cPanel updates and cause issues with mail.
 

kazaa

Member
Apr 11, 2006
11
2
153
I finally figured it out, after several hours trouble shooting DNS and email logs etc it ended up being a setting in
WHM. I dont know how this setting got turned on but it did some how and I was totally aware of it.

In case someone else has the same issue here is the setting I had to turn off.
tweak settings->Mail->Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak).

Thanks guys for your time and support.