Sending email from LAN PCs to local email server

0

I'll start with saying: I'm not sure what exactly I need. I googled for "sendmail LAN" and variants, and it seems I need a "null client" setup. So that is my assumption, not my requirement (hence the not so clear title)

Shortly: I have 1 centos (v6) server running XMail server (latest), which hosts email for a few domains, incoming and outgoing. I have a PC in the LAN that is able to SMTP and POP for the accounts hosted on it. The server itself is able to send email both local (like from cron jobs) and domain users.

Let's call this "server".

Now I have a need to configure an existing CentOS server (v5) to send its local (cronjob) emails (scripts are using sendmail) and also php scripts to be able to send out emails (but those usually configure the smtp user/pass, so that should be good; I haven't gotten that far yet)

Let's call this "client".

On "client" I configured a null client sendmail thing based on this: http://www.faqs.org/docs/securing/chap22sec177.html

There are only those 4 lines in the null.mc, with the domain changed to mine (let's use example.com)

OSTYPE('linux')dnl
DOMAIN('generic')dnl
FEATURE('nullclient','example.com')dnl
undefine('ALIAS_FILE')dnl

There is a line in /etc/hosts mapping example.com to the LAN IP of "server". (Ping responds properly). Also, telnet on port 25 is connecting and responding properly.

I then issued

#sendmail -v root@example.com < /tmp/email.txt

where the result is

root@example.com... Connecting to [127.0.0.1] via relay...
root@example.com... Deferred: Connection refused by [127.0.0.1]

May be a dumb question, but why is it trying to connect to localhost instead of example.com on the LAN? Is it not a null client configuration that I need? Or am I missing some stuff not covered by the tutorials?

Thank you.

ciuly

Posted 2017-04-05T11:31:03.827

Reputation: 245

I really recommend using a more modern mailing program on the "client". Configuring sendmail can be a PITA. – dirkt – 2017-04-06T09:54:35.073

if by "modern" you mean a GUI app, then that's out of the question since the "client" is actually a server box, so no desktop on it. If you mean something else, please provide an example so I can try it out. – ciuly – 2017-04-09T16:37:42.443

I actually don't know any sendmail replacement with GUI, and I doubt such a thing exists. More modern mailers are for example exim, qmail, or postfix. E.g. on Debian, exim is the default. – dirkt – 2017-04-09T17:15:51.320

Answers

0

I can't help you configure the entire server as I've not configured this kind of thing before, but your question about why it is connecting to 127.0.0.1 I can spread some light on.

sendmail is a mail client when called in the way you've called it. Imagine it working the same way as thunderbird or outlook - it still needs to connect to a MTA to send the email on.

In this case, the MTA (Mail server) is infact the same server - it's address is 127.0.0.1.

You'll see the same 'oddity' if you sent an email to an address configured on the server from an external email address - it'd recieve on the 'public' ip of the server, the connect from 127.0.0.1 back to 127.0.0.1 for the 'delivery' phase of the transaction.

djsmiley2k TMW

Posted 2017-04-05T11:31:03.827

Reputation: 5 937

The part I'm not getting is that I specified nullclient feature for a host. I'd expect the MTA to be that host, no? Thunderbird for ex requires a full configuration of user/pass/host/port/and what not, I expected to see a similar thing for my scenario yet it's not there. So understanding that it needs an MTA to connect to, why is it picking up localhost instead of the configured host? – ciuly – 2017-04-05T13:08:21.403