C
C
ChildrenofkoRn2012-08-12 18:42:05
send mail
ChildrenofkoRn, 2012-08-12 18:42:05

Sendmail: how to set up sending from the right IP and domain?

Input:
Ubuntu 12.04 LTS
sendmail 8.14.4-2ubuntu2

cat /etc/hosts:
# IPv4
127.0.0.1 localhost
ip01 domen01.tld myserver
ip02 domen02.tld


sendmail out of the box, used for mailing scripts and sending notifications from CMS, well, system /var/mail/.

sendmail stubbornly takes the hostname of the “myserver” machine, then parses the hosts, gets ip01 and domen01.tld, and sends from them.
It is necessary that it be sent only from the second ip02 and the domain domen02.tld.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaliy, 2012-08-13
@ChildrenofkoRn

outgoing ip for sendmyl is
CLIENT_OPTIONS(`Name=IPv4, Family=inet,Addr=reality')
and by domain read about the word masquerading. I didn’t read it - because it suits me how it sends with `hostname` (the first one in your version).

I
Ilya_Drey, 2012-08-12
@Ilya_Drey

Can you show the CMS code responsible for sending email? In my opinion, it is easier to specify in the CMS which email to use when sending explicitly ([email protected]) ​​and sendmail will chew it normally.

P
Puma Thailand, 2012-08-13
@opium

In general, sendmail does not know how to change ip and domains natively, and the domain from which the letter comes must be entered manually in the from field, and the IP address can be changed either using a paid module or using iptables.
The surest way for you is to simply change the ip in the network settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question