1833926 Members
3182 Online
110063 Solutions
New Discussion

mailx question

 
SOLVED
Go to solution
Hunki
Super Advisor

mailx question

mailx -s "Subject" email@mail.com

How do I end the above statement if I dont have a file to send.

eg. Generally when I have a file I do a redirection but when I dont have one then how do I send a mailx.
5 REPLIES 5
Court Campbell
Honored Contributor
Solution

Re: mailx question

mailx -s "Subject" email@mail.com < /dev/null
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Olivier Masse
Honored Contributor

Re: mailx question

Try:

mailx -s "test" email@email.com
But mailx complains and this kind of null mail seems to be filtered by our corporate e-mail server.

Instead you can do:

echo "" | mailx -s "test" email@email.com
Court Campbell
Honored Contributor

Re: mailx question

> But mailx complains and this kind of null mail seems to be filtered by our corporate e-mail server.

mailx -s "Subject" email@mail.com < /dev/null > /dev/null

hehe


"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Hunki
Super Advisor

Re: mailx question

Thanks!
Dennis Handly
Acclaimed Contributor

Re: mailx question

Besides echo, you can of course type something in and then use "." or EOD (control-D).
Or use a here document:
$ mailx -s "Subject" email@mail.com <mail body
EOF