Question : How to use mailx to relay email from a Solaris server via an SMTP server on the same network

Hi

This is a basic question for which I apologise. It is also something I have done before, but on this new server it is not working.

I want a backup (cron) job to email me its logfile. I use a line such as:

 /bin/cat $LOGFILE | /bin/mailx -s "Backup log" [email protected].

In the past I have succeeded without running sendmail daemon on the server in question, simply by editing the /etc/hosts file to include a line like:

192.168.10.1   mailhost

But this time I am receiving the following if I run in verbose mode:

$ [email protected]... Connecting to [127.0.0.1] via relay...
[email protected]... Deferred: Connection refused by [127.0.0.1]

If I use /usr/bin/sendmail I get the same message. It looks to me as though mailx/sendmail is not finding my reference to the mail server.
Could someone help me find the obvious oversight I am missing?
Many thanks
Manfred

Answer : How to use mailx to relay email from a Solaris server via an SMTP server on the same network

Sendmail 8.12 and later use two instances of sendmail (an MTA and an MSP)  for security reasons. When a local user sends a message via sendmail or directly invokes sendmail they are submitting the message to the MSP process, which then relays the message to the MTA for delivery via the localhost IP. To fix this you need to have the usual Sendmail daemons running. For security and to restrict Sendmail's use to the local machine you can include:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

in your sendmail.mc and build a sendmail.cf from that. It will cause the MTA to only bind to the localhost IP and thus not respond to connections from outside of the local system.

FYI:
MTA - Mail Transport Agent
MSP - Mail Submission Agent
Random Solutions  
 
programming4us programming4us