Why does echo work through pipe but not cat with msmtp?

0

This works:

echo "yada yada" | msmtp my@mail.com

but not this:

cat yadayada.txt | msmtp my@mail.com

which delivers the email with empty content.

Why does echo work through pipe but not cat with msmtp ?

user19496

Posted 2013-08-07T21:31:51.243

Reputation: 1 205

Is your yadayada.txt formatted funny or have weird permissions? It works fine for me catting it out. – nerdwaller – 2013-08-07T21:52:03.487

yadayada.txt has u:rw g:rw o:r and is a multiline file.
sample content: === rsync start === 2013-08-07 20:58:01 === rsync stop === 2013-08-07 21:00:50
– user19496 – 2013-08-07T21:56:59.070

this worked: tr -d ':' < yadayada.txt | msmtp my@mail.com – user19496 – 2013-08-07T22:26:03.710

':' was the culprit. thx @nerdwaller you pointed me in the right direction. – user19496 – 2013-08-07T22:27:59.857

That makes sense, since msmtp allows uses of something like Subject: My subject line. Good catch! – nerdwaller – 2013-08-07T22:32:33.923

Answers

0

msmtp seems to rely on a wellformed email message in the file being read.

Ex.

Subject: My subject line  
My body text

Since I don't care about Subject etc
(I'm sending an email when a logfile is modified using incron)

tr -d ':' < yadayada.txt | msmtp my@mail.com

is a Q&D way to get the logfile content sent using msmtp.

user19496

Posted 2013-08-07T21:31:51.243

Reputation: 1 205