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@xxxxxx>
Posted via http://www.newsoffice.de/

.



Relevant Pages

  • Re: Sending Mail from Script: Setting Header
    ... occasionally attachment. ... Right now I'm using mutt for this task, ... also contains custom headers. ...
    (comp.os.linux.misc)
  • Re: Desperate to spell-check Subject line
    ... I don't want to edit full headers on every compose....and I ... Mutt does not check spelling. ... editor that's going to do this. ... line and run it through a spell checker and then reinsert it. ...
    (comp.mail.mutt)
  • Re: Sending Mail from Script: Setting Header
    ... Make is very easy to send mail with attachements ... Right now I'm using mutt for this task, ... also contains custom headers. ... Ronald Fischer ...
    (comp.os.linux.misc)
  • Re: debian-user and mutt...
    ... AFAIK in mutt you have to hit L to reply-to-list The ... modify the variable 'lists' as well. ... mail is from a list or not (using the mail headers I guess). ... -- Robert Dieterich's contribution to the 2004 Perl Haiku Contest, ...
    (Debian-User)
  • Re: Mutt - decoding of QP-escaped headers
    ... | My Mutt seems not to decode some QP-escaped ... | mailers do decode such headers properly; ...
    (Debian-User)