?
Solved

How to get mailx to use return address from Linux

Posted on 2009-04-24
4
Medium Priority
?
2,207 Views
Last Modified: 2013-12-18
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
Comment
Question by:dmn9165dnelson
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:lnkevin
ID: 24226260
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
 

Author Comment

by:dmn9165dnelson
ID: 24226463
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
 
LVL 26

Expert Comment

by:lnkevin
ID: 24228427
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
 

Accepted Solution

by:
dmn9165dnelson earned 0 total points
ID: 24452035
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As cyber crime continues to grow in both numbers and sophistication, a troubling trend of optimization has emerged over the last year.
New style of hardware planning for Microsoft Exchange server.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question