Operating System - Linux
1748198 Members
2605 Online
108759 Solutions
New Discussion юеВ

Re: Scripting Mail on Suse

 
SOLVED
Go to solution
TheJuiceman
Super Advisor

Scripting Mail on Suse

Hey everyone,

I'm trying to use a script to send a mail notification. I've tried using nail (ie. nail -s "Subject" me@domain.com) but it is requiring an interrupt (Cntl D) to complete. How can I script this? Thanks.
3 REPLIES 3
Muthukumar_5
Honored Contributor
Solution

Re: Scripting Mail on Suse

See this:

http://nail.sourceforge.net/man/nail.1.html

It is useful. Sending mail through scripts are as,

http://nail.sourceforge.net/man/nail.1.html#30

--
Muthu
Easy to suggest when don't know about the problem!
Ivan Ferreira
Honored Contributor

Re: Scripting Mail on Suse

You need to pass the body, create a text file with the body contents, for example, message.txt, and use

mail -s "subject" user@domain.com < message.txt

The message.txt can be any text file, this could be the log of an application or a backup.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
TheJuiceman
Super Advisor

Re: Scripting Mail on Suse

Very helpful, gents. Many thanks!!!