[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msmtp-users] patch msmtp to add custom header



On Tue, Feb 17, 2009 at 09:23:01AM +0100, Matus UHLAR - fantomas wrote:
> > On 17/02/09 03:54:18, Matus UHLAR - fantomas wrote:
> > > I would like to use msmtp as sendmail for CGI/PHP scripts.
> > > 
> > > For CGI scripts I would like to push extra header line to
> > > SMTP server which would append UID of process that executed
> > > msmtp to mail headers (e.g. "X-Sending-UID: %d"), to make
> > > searching for broken scripts in case of spam outbreak easier
> > > (we use suexec, so each user's scripts are executed under
> > > their UID). PHP has such functionality (if patched with the
> > > mail header patch) but CGI is something different :)
> 
> On 17.02.09 18:34, Robert Thorsby wrote:
> > I often include extra headers in my scripts.
> > 
> > If the first paragraph (ie, up to the first blank line) contains only 
> > headers then msmtp will treat them as such. You can use this to add "X" 
> > headers, Message-Ids etc and to expand the To and From headers (ie, 
> > js@...45... as the recipient in the command line can be expanded to 
> > "John Smith <js@...45...>" in the first paragraph of headers).
> 
> I can not expect any scripts that calls msmtp (sendmail) to push that
> header. I need msmtp to appent/prepend it.
> 
> I've been used patched ssmtp to do this. I would like to switch to msmtp
> because of ability using $HOME/.msmtprc for configuring smtp servers,
> authentication etc. I have some other problems passing some env variables to
> it (suexec,PHP like to drop'em all), but currently it partially works. 
> I now need the extra header.

Why can't you just create a script that adds the header you
wants to stdin and pipes everything to msmtp? Then make "sendmail" on
your machine a symlink to that shell script instead of msmtp. Or if you
don't want the extra headers on all outgoing mail, just see whether you can
configure your CGI scripts to use it as sendmail.

-- 
Jim Pryor
jim@...173...