Joshua Pettett | 17 Feb 2012 01:23
Picon

How is Date header supposed to be added?

vixie-cron and mailx seem to expect the local MTA/MSA to add the Date: header 
to outgoing mail, as sendmail and ssmtp do.  Is there a way to get msmtp to do 
so, or a best practice I am missing here?

--

-- 
Joshua Pettett

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
Martin Lambers | 17 Feb 2012 06:57
Picon

Re: How is Date header supposed to be added?

On Thu, 16 Feb 2012 19:23:33 -0500, Joshua Pettett wrote:
> vixie-cron and mailx seem to expect the local MTA/MSA to add the
> Date: header to outgoing mail, as sendmail and ssmtp do.  Is there a
> way to get msmtp to do so, or a best practice I am missing here?

Currently msmtp does not do this; it assumes that either the user agent
or the MTA at the SMTP server does it (or that it is ok to not have
a Date header).

A wrapper script should work:
----------
#!/bin/sh
formail -b -f -a "Date: `date -R`" | msmtp "$ <at> "
----------

Martin

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
Joshua Pettett | 18 Feb 2012 04:51
Picon

Re: How is Date header supposed to be added?

Thanks for the response.  But is it possible to get cron to use this without 
custom-compiling it?  I understand that it's not your responsibility to 
compensate for the shortcomings of other programs, but I was hoping to find a 
solution that Just Works, since I admin multiple boxes.  But I need to be able 
to override the sending address, so ssmtp won't work for me either.

-- 
Joshua Pettett
Web and Internet Technician
HomeLink Computer Services
http://www.homelinkcs.com
Jabber: depquid <at> jabber.org

On Friday, February 17, 2012, Martin Lambers wrote:
> On Thu, 16 Feb 2012 19:23:33 -0500, Joshua Pettett wrote:
> > vixie-cron and mailx seem to expect the local MTA/MSA to add the
> > Date: header to outgoing mail, as sendmail and ssmtp do.  Is there a
> > way to get msmtp to do so, or a best practice I am missing here?
> 
> Currently msmtp does not do this; it assumes that either the user agent
> or the MTA at the SMTP server does it (or that it is ok to not have
> a Date header).
> 
> A wrapper script should work:
> ----------
> #!/bin/sh
> formail -b -f -a "Date: `date -R`" | msmtp "$ <at> "
> ----------
> 
> Martin
(Continue reading)

Martin Lambers | 18 Feb 2012 10:28
Picon

Re: How is Date header supposed to be added?

On Fri, 17 Feb 2012 22:51:38 -0500, Joshua Pettett wrote:
> Thanks for the response.  But is it possible to get cron to use this
> without custom-compiling it?

The easiest way is to use the wrapper script around msmtp that I
suggested: no need to custom-compile anything, you just copy a one-line
script to your boxes.

Building this directly into msmtp would be a little more work, since
msmtp currently assumes that it must never alter the contents of a
mail. Therefore, it has no idea about the mail structure, and in
particular it does not know which headers are already present.

Martin

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
Joshua Pettett | 21 Feb 2012 17:36
Picon

Re: How is Date header supposed to be added?

I'm afraid I'm still missing something here.  How do I get the wrapper between 
cron and msmtp?  Any changes I make to symlinks or files that cron or msmtp use 
will be overridden by package managers at upgrade-time.

-- 
Joshua Pettett
Web and Internet Technician
HomeLink Computer Services
http://www.homelinkcs.com
Jabber: depquid <at> jabber.org

On Saturday, February 18, 2012, Martin Lambers wrote:
> On Fri, 17 Feb 2012 22:51:38 -0500, Joshua Pettett wrote:
> > Thanks for the response.  But is it possible to get cron to use this
> > without custom-compiling it?
> 
> The easiest way is to use the wrapper script around msmtp that I
> suggested: no need to custom-compile anything, you just copy a one-line
> script to your boxes.
> 
> Building this directly into msmtp would be a little more work, since
> msmtp currently assumes that it must never alter the contents of a
> mail. Therefore, it has no idea about the mail structure, and in
> particular it does not know which headers are already present.
> 
> Martin

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
(Continue reading)

Martin Lambers | 21 Feb 2012 21:10
Picon

Re: How is Date header supposed to be added?

Hi Joshua!

On Tue, 21 Feb 2012 11:36:55 -0500, Joshua Pettett wrote:
> I'm afraid I'm still missing something here.  How do I get the
> wrapper between cron and msmtp?  Any changes I make to symlinks or
> files that cron or msmtp use will be overridden by package managers
> at upgrade-time.

How do you currently make your cron call msmtp? If you can change a
configuration file, there should be no problem. If your system
has to install msmtp as /usr/sbin/sendmail or similar to make cron
use it, then it depends on your package manager how to avoid overrides
of local changes. I'm afraid I cannot help with that.

Martin

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Matus UHLAR - fantomas | 17 Feb 2012 14:32
Picon
Favicon

Re: How is Date header supposed to be added?

On 16.02.12 19:23, Joshua Pettett wrote:
>vixie-cron and mailx seem to expect the local MTA/MSA to add the Date: 
>header to outgoing mail, as sendmail and ssmtp do.  Is there a way to 
>get msmtp to do so, or a best practice I am missing here?

it's the MUA that is expected to add the header, and some MTA's add it 
if they receive mail without them. Courier, for example, has the 
possibility to generate the Date: (along with the Message-Id:) header, 
if it is told to (e.g. for local users).

Note that msmtp is designed to do the message submission, not creation.
but you can use Martin Lambers' wrapper if you need.
However I would advise to use mailx or mutt to send the mail.
--

-- 
Matus UHLAR - fantomas, uhlar <at> fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"One World. One Web. One Program." - Microsoft promotional advertisement
"Ein Volk, ein Reich, ein Fuhrer!" - Adolf Hitler

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/

Gmane