4

I have in the past heard of using nail for this task, but I can't seem to find it for my distribution (Ubuntu 11.04) in any of the repositories. What program can I use to one-off emails from a shell like so:

send-mail -to [email protected] -file attachment.zip -message "Hello World"

Is there a program out there through which I can script mail sending as above?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311

2 Answers2

5

nail was renamed to Heirloom mailx. For Ubuntu, you want to install the heirloom-mailx package, and then read the Sending mail from scripts section of the manpage.

cjm
  • 26,740
  • 12
  • 88
  • 84
  • Where is the `mail.rc` file stored? I'd like to store my account info in there. – Naftuli Kay May 31 '11 at 01:11
  • @TK, do you mean `/etc/nail.rc` (note the `n`) or `~/.mailrc`? See the [env vars & files sections](http://heirloom.sourceforge.net/mailx/mailx.1.html#19) of the mailx manpage. – cjm May 31 '11 at 01:30
  • `~/.mailrc`. Thanks, I've got it all configured now! :) – Naftuli Kay May 31 '11 at 02:03
1

You can use ls -ltr | mail -s "Files in sys" [email protected]

Ramesh
  • 38,687
  • 43
  • 140
  • 215
Mina
  • 11
  • 2