1829743 Members
1230 Online
109992 Solutions
New Discussion

mail problem

 
SOLVED
Go to solution
Jeff Daigle
Advisor

mail problem

Hello, I am trying have this script send a mail. This is how I tried it:
mail -s "file not found" bob@abc.com
and I tried
mailx -s "file not found" bob@abc.com

Both ways, when I ran the program, it hung. I think it was waiting for the body or the mail, the CTRL-D command and the CC: part of the mail. Any way to do all this in the script?
Thanks in advance!
4 REPLIES 4
Jordan Bean
Honored Contributor

Re: mail problem

Yes, it was waiting for input. Try

mailx -s 'subject' address < /dev/null

It will gripe about a null message, but that's okay.
Jared Westgate_1
Valued Contributor
Solution

Re: mail problem

Hello,

If I don't want to send any actual text in the message (just a subject) I use:

echo "" | mailx -s 'subject' address

It's a nice way to avoid the null messages.

Jared
R Madhavan
Frequent Advisor

Re: mail problem

elm should work perfectly without any complaint about null body, try...
#elm -s "file not found" bob@abc.com
federico_3
Honored Contributor

Re: mail problem

you should do like this:

echo "what you want to send"| mailx -s "subject " bob@abc.com

or, if you prefer to send a file

cat file| mailx -s "subject " bob@abc.com