Re: Sending Mail from Script: Setting Header
Ronald Fischer <ronaldf@eml.cc> wrote:
> 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
>
>
Try mailx. I use it on my scripts to send automated reports. I don't know if it can send custom header. For sending mail with custom headers, I modified a phpmailer class for php to do that , maybe it can be used in cgi mode on a shell script. I can post it if you think it could be useful.
Mauricio Asenjo
|