Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 me@email.com -file attachment.zip -message "Hello World"

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

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
Where is the mail.rc file stored? I'd like to store my account info in there. –  Naftuli Tzvi Kay May 31 '11 at 1:11
    
@TK, do you mean /etc/nail.rc (note the n) or ~/.mailrc? See the env vars & files sections of the mailx manpage. –  cjm May 31 '11 at 1:30
    
~/.mailrc. Thanks, I've got it all configured now! :) –  Naftuli Tzvi Kay May 31 '11 at 2:03

You can use ls -ltr | mail -s "Files in sys" yourmail@domain.com

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.