PDA

View Full Version : Send Mail Command Line


mphayesuk
24th June 2006, 20:20
I have almost written my backup script but what I want to do is email the log file my script creates.

So what I need is an example of how to email from the command line (shell script)

Thanks

vlsimpson
24th June 2006, 21:29
The old Berkeley mail prog:
cat logfile | mail -s 'backup log' emailaddress

for nail (http://heirloom.sourceforge.net/mailx.html) (if you have it)
nail -s 'backup log' -a logfile emailaddress

mphayesuk
24th June 2006, 23:02
Well its using postfix, suse10 and everything is setup as the guides by falko, I will try the two methods you have put on in the morning.

Thanks

vlsimpson
25th June 2006, 15:59
I forgot mutt (http://mutt.org). You can use it similarly to my previous example.

mphayesuk
25th June 2006, 16:08
Works great thanks