?
Solved

Email going to wrong domain after ip change on server

Posted on 2013-11-13
15
Medium Priority
?
303 Views
Last Modified: 2014-01-22
Hi

we have a server (debian) running apache with several virtual hosts
We have recently changed one of the virtual hosts ip address

Now when we send an email from the site with the new ip , the email is received by a different domain

eg.

email sent to info@abc.com is received by info@xyz.com

both abc.com and xyz.com are hosted on the same server

Both used to have the same ip and the email was working fine.
The problem started after  abc.com was set to have a different ip.
0
Comment
Question by:broadcastwarehouse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 43

Expert Comment

by:Rob
ID: 39686815
Did you update the mx record in the DNS for that domain?
0
 

Author Comment

by:broadcastwarehouse
ID: 39689357
Hi , mx records have been changed.
This problem only occurs if the message is sent from the server.

If emails are sent from gmail for example they get delivered fine.

I'm guessing something in the header set by sendmail or something on the server is causing the issues because of the ip change
0
 
LVL 43

Expert Comment

by:Rob
ID: 39693989
So being on the same server the virtual hosts need to specify what domain they're sending from.  Are you setting the From: in the header when sending? Can you post yr php around sending an email?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:broadcastwarehouse
ID: 39694879
This occurs when sent from the command line on the server as well
below is a sample php used to send the email.
I believe the emails are sent by sendmail

$to = "abc@xyz.com";
$subject = "Test mail";
$message = "Hello! \nThis is a simple email message.";

$headers = "From:abc@xyz.com";
$headers .= "\r\nReply-To: abc@xyz.com";
$headers .= "\r\nReturn-Path: abc@xyz.com";
$headers .= "\r\nX-Mailer: PHP/".phpversion();

mail($to,$subject,$message,$headers);

Open in new window

0
 
LVL 43

Expert Comment

by:Rob
ID: 39694887
In your Example above don't you mean that the "to" should be info@abc.com not @xyz.com?
0
 

Author Comment

by:broadcastwarehouse
ID: 39694901
Hi , You are right , sorry about that.
 I've ammended the code as below.
In the test that i'm running i've set the to and from addresses to be the same

$to = "info@abc.com";
$subject = "Test mail";
$message = "Hello! \nThis is a simple email message.";

$headers = "From:info@abc.com";
$headers .= "\r\nReply-To: info@abc.com";
$headers .= "\r\nReturn-Path: info@abc.com";
$headers .= "\r\nX-Mailer: PHP/".phpversion();

mail($to,$subject,$message,$headers);

Open in new window

0
 
LVL 43

Expert Comment

by:Rob
ID: 39694924
And when you run that script it's info@xyz.com that receives it?
0
 

Author Comment

by:broadcastwarehouse
ID: 39694940
yes
another example would be :

test@abc.com (existing address)
test@xyz.com( does not exist)

if the message is sent to test@abc.com  there is a bounce back because it tries to deliver to test@xyz.com,
0
 
LVL 43

Expert Comment

by:Rob
ID: 39694981
Thanks for going over that again.  It really helps.

How did you go about configuring sendmail to host multiple domains?

Do you have a virtual user table mapping the users to the domains?

Detailed setup here:  http://www.sendmail.com/sm/open_source/tips/virtual_hosting/
0
 

Author Comment

by:broadcastwarehouse
ID: 39698585
Hi
I forgot to mention that it was all working fine before we changed the ip of the virtual host abc.com to be different from the servers ip
0
 
LVL 43

Expert Comment

by:Rob
ID: 39699117
And changing it back isn't an option?
0
 

Author Comment

by:broadcastwarehouse
ID: 39713470
Unfortunately changing it back is not an option :(
0
 
LVL 43

Expert Comment

by:Rob
ID: 39713474
0
 

Accepted Solution

by:
broadcastwarehouse earned 0 total points
ID: 39788108
managed to fixed it

the etc/vhosts file needed to be edited to match the new ip for the domain that was changed
0
 

Author Closing Comment

by:broadcastwarehouse
ID: 39799429
fixed by trial and error
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
This article outlines some of the reasons why an email message gets flagged as spam on a recipient's end.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question