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


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"

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:   mailhost

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

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

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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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=, Name=MTA')dnl

in your and build a 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.

MTA - Mail Transport Agent
MSP - Mail Submission Agent

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mmilhoferAuthor Commented:
Thank you jlevie, most helpful.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.