Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ?

share|improve this question
    
Is your yadayada.txt formatted funny or have weird permissions? It works fine for me catting it out. –  nerdwaller Aug 7 '13 at 21:52
    
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 Aug 7 '13 at 21:56
    
this worked: tr -d ':' < yadayada.txt | msmtp my@mail.com –  user19496 Aug 7 '13 at 22:26
    
':' was the culprit. thx @nerdwaller you pointed me in the right direction. –  user19496 Aug 7 '13 at 22:27
    
That makes sense, since msmtp allows uses of something like Subject: My subject line. Good catch! –  nerdwaller Aug 7 '13 at 22:32

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.