Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When sending e-mail with /usr/sbin/sendmail (e.g., using a script), Postfix causes the mail to be sent using one of the host's interface aliases (eth0:0, 74.50.122.55) instead of using the primary interface (eth0, 66.232.99.54)...

[root@www ~]# cat test.msg 
To: epretorios@gmail.com
Subject: This is a bogus e-mail

This is a bogus e-mail.
[root@www ~]# sendmail -t -i < test.msg

Results in e-mail headers like this:

Return-Path: <root@www.rocket-powered.com>
Received: from www.rocket-powered.com ([74.50.122.55])
        by mx.google.com with ESMTPS id c4si14411712yhe.53.2013.04.13.11.39.16
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Sat, 13 Apr 2013 11:39:16 -0700 (PDT)
Received-SPF: fail (google.com: domain of root@www.rocket-powered.com does not designate 74.50.122.55 as permitted sender) client-ip=74.50.122.55;
Authentication-Results: mx.google.com;
       spf=hardfail (google.com: domain of root@www.rocket-powered.com does not designate 74.50.122.55 as permitted sender) smtp.mail=root@www.rocket-powered.com
Received: by www.rocket-powered.com (Postfix, from userid 0)
    id CA46D39412D; Sat, 13 Apr 2013 18:32:14 +0000 (UTC)
From: bogus@gmail.com
To: epretorios@gmail.com
Subject: This is a bogus e-mail

Why is Postfix using the interface alias (eth0:0, 74.50.122.55) instead of using the primary interface (eth0, 66.232.99.54)?

FWIW: e-mail submitted for delivery via SMTP is routinely delivered using the primary interface (eth0, 66.232.99.54). e.g.,

Return-Path: <administrative@rocket-powered.com>
Received: from www.rocket-powered.com (rocket-powered.com. [66.232.99.54])
        by mx.google.com with ESMTPS id s61si9056793yhd.296.2013.04.13.17.28.36
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Sat, 13 Apr 2013 17:28:36 -0700 (PDT)
Received-SPF: pass (google.com: domain of administrative@rocket-powered.com designates 66.232.99.54 as permitted sender) client-ip=66.232.99.54;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of administrative@rocket-powered.com designates 66.232.99.54 as permitted sender) smtp.mail=administrative@rocket-powered.com
Received: from www.rocket-powered.com (localhost [IPv6:::1])
    by www.rocket-powered.com (Postfix) with ESMTPA id 979D23940F7
    for <epretorios@gmail.com>; Sun, 14 Apr 2013 00:21:33 +0000 (UTC)
DomainKey-Signature: a=rsa-sha1;  q=dns; c=nofws;
  s=default; d=rocket-powered.com;
  b=Y5YVbjb5mXPJgyDkMjXdanWRCM4gdEjIdbgouOpDJ6hEAObGcaokpiidfhc29lvBezLyZL06++gL1oyd+bjrywd1I9sqlB0i5Tfjig2ufKLEizcSeyTkDWjm/jKP6TIy;
  h=Date:To:From:Reply-To:Subject:Message-ID:X-Priority:X-Mailer:MIME-Version:Content-Type;
Date: Sun, 14 Apr 2013 00:21:33 +0000
To: Fred Flintstone <epretorios@gmail.com>
From: "Rocket-Powered.com" <administrative@rocket-powered.com>
Reply-To: "Rocket-Powered.com" <administrative@rocket-powered.com>
Subject: Welcome
share|improve this question

1 Answer 1

You need to set inet_interfaces to the address or corresponding host name of the interface that you want Postfix to use. Depending on which interfaces (IP addresses) you want Postfix to receive mail through, you may just want to set this option for the SMTP client service in master.cf. I like to make sure myhostname is set correctly, then use that to set inet_interfaces:

smtp      unix  -       -       n       -       -       smtp
  -o inet_interfaces=$myhostname

Note that the difference between the SMTP client service and SMTP server daemon in master.cf is subtle; the latter has smtpd at the end of the line.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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