View Single Post

  #1 (permalink)  
Old 10-20-2006
Ronald Fischer
 
Posts: n/a
Default Sending Mail from Script: Setting Header

I have a zsh Script which dynacmically sends out a status mail.
The mail sent out contains Cc, Bcc and Reply-To headers and
occasionally attachment.

Right now I'm using mutt for this task, because it is very
convenient to specify this information on the mutt command line,
i.e.

REPLYTO=rtaddr mutt -b bccaddr -c ccaddr -a attachment -s subject toaddr
<body

where body is the file containing a mailbody. This works very well so
far.

Now I would like to extend the application in that the email being sent
also contains custom headers (such as X-Priority). There is no option
where I can tell mutt to put in additional headers.

This *can* be done, but both possibilities are a little bit complicated:

One way to do it would be to prepare the Email so that it already
contains *all* headers in addition to the mailbody, and then use

mutt -H ...

to send the mail. The other possibility is to generate dynamically
a mutt resource control file, in which the custom headers are placed,
and then use mutt's -F switch to load this file.

So before I try one of these, I would like to ask what approach other
users use to easily send mail using attachments from a script. A
solution
working on shell level would be preferable, but different approaches
in Perl, Ruby, Tcl or Python would also be interesting.

Ronald


--
Ronald Fischer <ronaldf@eml.cc>
Posted via http://www.newsoffice.de/

Reply With Quote