0

I am concatenating xmsg and links to new variable body. What I am trying to accomplish is when email send out. I want new line between xmsg and `links

xmail="sendmail"

links="<a href="https://www.xxx>Unsubscribe</a>"
xmsg='Hello World'
body=$xmsg \n $links

### Compose emails one at a time, per loop.
"$xmail" "$email" << EOF
subject:$xsub
from:$xfrom
Content-Type: text/html;
Mime-version:1.0;
$body
EOF

Excepted output in email

Hello World
Unsubscribe

I tried almost everything here. But none works, either I get blank body in email or all in same line

mtkilic
  • 1,213
  • 1
  • 12
  • 28

1 Answers1

1

You're sending an HTML email and need to use <br> instead of \n.

You need to enclose the whole string in double quotes. Try body="$xmsg <br> $links"