0

I have two domain names(eg. aaa.com and bbb.com) hosted on one vps with sendmail.

My problem is that when I register in aaa.com I get the email from bbb.com.

Please tell me how to configure sendmail to send emails from the corresponding domain name so that emails sent from aaa.com will appear as coming from aaa.com and emails coming from bbb.com will appear as coming from bbb.com.

UPDATE: Bellow is header from my Hotmail account. Notice that it contains both domains. I need to configure so that only one appears.

x-store-info:4r51+eLowxxxxxxxxxxxxxxxx+Jr9bBBOgMyiUm19XMY5Rxxxxxxxxxxxxxxxxxxxxxxx=
Authentication-Results: hotmail.com; spf=none (sender IP is xxx.xxx.xxx.xxx)    smtp.mailfrom=www-data@aaa.com; dkim=none header.d=aaa.com; x-hmca=none header.id=admin@aaa.com
X-SID-PRA: admin@aaa.com
X-AUTH-Result: NONE
X-SID-Result: NONE
X-Message-Status: n:n
X-Message-Delivery: Vj0xLjE7dXM9MDxxxxxxxxxxxxxxxxxxxxxxxxxx
X-Message-Info: z6+tzUa3IoTXR87giofdF9roKbKDipmFxxxxxxx+8w+3EpLxxxxx
Received: from bbb.com ([x.x.x.x]) by SNT0-MC1-F6.Snt0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4900);
 Sun, 1 Dec 2013 12:13:53 -0800
Received: from bbb.com (localhost [127.0.0.1])
by bbb.com (8.14.4/8.14.4/Debian-2.1ubuntu2) with ESMTP id rB1Kxxxxxxxx
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
for <bml13@hotmail.com>; Sun, 1 Dec 2013 21:13:52 +0100
Received: (from www-data@localhost)
by bbb.com (8.14.4/8.14.4/Submit) id rB1Kxxxxxxxxxxx;
Sun, 1 Dec 2013 21:13:52 +0100
Message-Id: <201312012013.rB1Kxxxxxxxx@bbb.com>
To: xxxxxx@hotmail.com
Subject: =?UTF-8?B?2YfYp9iq2YXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2LHZiNix?=
X-PHP-Originating-Script: 0:mail.php
MIME-Version: 1.0
Date: Sun, 01 Dec 2013 20:13:52 +0000
From: =?UTF-8?B?2YfYpxxxxxxxxxxxxxxxxxx==?=<admin@aaa.com>
Reply-To: =?UTF-8?B?2YfYxxxxxxxxxxxxxxxxx==?=<admin@aaa.com>
X-Mailer: PHP/5.4.9-4ubuntu2.3
Content-Type: multipart/related; boundary="----=_NextPart_b3670a170xxxxxxxxxxxxxxxxxxx"
Return-Path: www-data@aaa.com
X-OriginalArrivalTime: 01 Dec 2013 20:13:53.0725 (UTC) FILETIME=[DB6CF6D0:01CEEED1]
  • 1
    This problem happens because the script that you are using to register users and mail them back the acknowledgement is not setting the From: header correctly. You have to edit it so as to make sure that it is set correctly for each of the two sites (maybe even maintain two separate copies of it that differ in the domain name) or even search for another form registration script. Not really a sendmail question. – adamo Dec 1 '13 at 21:44
  • I tested with another email and the from address is correct but the message header still shows both domains aaa.com and bbb.com. see the header attached with the question. – bml13 Dec 2 '13 at 6:20
2

You are misunderstanding how sendmail works if you think it can "masquerade" as a different server for each email it sends.

You have set the From: address correctly, and that shows as aaa.com, as it should.

The server still has one single fully-qualified domain name by which it knows itself, which in your case seems to be bbb.com, and it will use that for generating all locally-created values (Message-Id:) and identifying itself in SMTP conversations (Received: from). Human beings aren't generally supposed to concern themselves with those bits of an email, so to the best of my knowledge sendmail offers no facility for changing those on the fly based on the domain of the email it sends.

If your app generates the (unique!) Message-Id, then sendmail won't need to, and it should preserve the ones you generate. But the identifier in the SMTP conversations is both fairly immutable and fairly unimportant, and you should probably not worry about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.