Send email attachment using a shell script

Todd Wease wease1 at coldbrains.com
Thu Jul 14 12:12:44 UTC 2005


On Thu, 2005-07-14 at 13:09 +0300, Hany Nagaty wrote:
> Hi all,
> 
> I'd like to send an email containing an attachmnet using a script.
> I've tried the mail command (in the mailx package), but I don't know
> how can I use it to send an attachment.
> 
> So, is there a way I can use mail to send an attachment, or is there
> other utility to do the job.
> 

This is a command line that will work if you have mutt installed.

$ cat <body file> | mutt -a <attach file> -s <subject> <to email>

Take a look at the man page for other command line options to mutt.

Todd




More information about the fedora-list mailing list