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

Re: [msmtp-users] truncate first line of message



Hi Guido!

On Thu, 15. Jan 2009, 15:27:18 +0100, Guido wrote:
>  I've a problem with msmtp. If I try to send a message by sendmail with 
> shell "sendmail -f guido@...183... pippo@...183... </etc/hosts" the content of 
> the file "/etc/hosts" is okay and also the sender.
> But if I've try msmtp  with shell "msmtp  -f guido@...183... pippo@...183... 
> </etc/hosts" the content of the file "/etc/hosts" isn't okay and there 
> isn't the sender.

It is intended that properly formatted mails are given to sendmail or
msmtp, with header lines, a blank line that separates header and body
and a body. Sendmail seems to apply some heuristics to guess that an
input file is not in this format so that it sends the file as the mail
body. Msmtp does not do this and splits /etc/hosts into headers and body
at the first blank line.

It is desirable to make msmtp completely compatible with sendmail, but
I'm reluctant to add heuristics to catch such a case. I don't think it
is possible to ever achieve 100% compatibility anyway.

As an easy workaround, you could format your data more like a proper
mail, e.g. use
(echo "From: me@...45..."; echo ""; cat /etc/hosts) | msmtp
This adds a header (consisting of only the From: line) and a blank line
separating header and body, so that your input file is sent as the body.
This should work with sendmail, too.

But ideally you would not just feed random files to sendmail or msmtp,
but let a mail user agent construct a proper mail from them first. You
could use mailx or Mutt for that purpose.

Martin