0

I am sending email from the cmd with msmtp for that I do

cat > test1 << EOF >From: "Tester" >test >EOF cat test1 | msmtp [email protected] 

This works while:

echo -e 'From: "Tester"\ntest' > test2 cat test2 | msmtp [email protected] 

Doesn't work although

diff test1 test2 

returned nothing and both

 file -bi test1 test2 

returned the same results

 message/rfc822; charset=us-ascii 
2
  • the new line \n isn't interprete with single quote Commented Jun 8, 2015 at 1:19
  • 1
    This has nothing to do with encoding and the diff should be returning something since the first cat would yield a two-line file while the echo command will only result in a one-liner. Either you've done something wrong or there is something you're not telling us. Commented Jun 8, 2015 at 1:24

1 Answer 1

1

The problem is you're not using the -e option with your echo command.

Try this:

echo -e 'From: "Tester"\ntest' > test2 cat test2 | msmtp [email protected] 

-e is for telling echo to interpret escaped chars (like "\n").

1
  • Ah sorry, I did have "-e" in my script, just did not posted it in the question. Commented Jun 8, 2015 at 15:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.