• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2230
  • Last Modified:

How to get mailx to use return address from Linux

We are moving scripts from a Solaris 9 server to a Linux server.  We are having a problem with certain phone providers not sending/receiving emails or pages unless a return address is sent.  This worked on Solaris by executing:
mailx -r dawn_nelson@mgic.com -s "ORA Error : `uname -n` : $ORACLE_SID" orapage > /dev/null < $l_log
On Linux we are using Postfix and it has been configured to look like sendmail.  Also, this code is inside a ksh script running in a bash environment.
Is there a simple way for me to get this to work on Linux?

Please assign to the correct zone as needed?

0
dmn9165dnelson
Asked:
dmn9165dnelson
  • 2
  • 2
1 Solution
 
lnkevinCommented:
Try this:

echo "Hi there" |mailx -s "This is your subject" -r sender@email.com recipient@email.com

where sender is your return address "From:" and reciepient is your "To:" address.

K
0
 
dmn9165dnelsonAuthor Commented:
I have tried many of these types of examples and it does not work.  Here is the output from running your example.
mailx: invalid option -- r
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
            [-- sendmail-options ...]
       mail [-iInNv] -f [name]
       mail [-iInNv] [-u user]

This should be easy, but the way they have the server setup, it makes it more complicated.  Linux server, where they are using Postfix but it is configured to look like sendmail.  Linux does not support the -r option for mailx.  All other articles that I have read say to use sendmail.  Is there a simple way to do this?
0
 
lnkevinCommented:
What flavor of your Linux server? Version? Some Linux use mail instead of mailx
Did you make sure mailx is available in the bin directory?
Did you do full path to where mailx resides? the previous post, I assumed that you were in the /usr/bin
If mailx is not existed on your server, download and put it in /usr/bin then cd to /bin and try my previous command.

K
0
 
dmn9165dnelsonAuthor Commented:
The way that our servers are configured, we had to use sendmail to be able to page certain group members.  Their phone carrier required a return address in order to send the page.  Here is what we ended up doing, for anyone interested:

   echo "SUBJECT: REVIEW needed on $hostid - chk4unixgroups" | cat - $WORKPATH/$hostid.chk4unixgroups.msgtxt \
           | /usr/lib/sendmail -f mgic_-_dba@mgic.com `cat $maillist`

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now