i am using mail command to send mails from my linux system.
The problem i am getting is the Content type of the mail is always as Content-Type: text/plain; charset=us-ascii
.
I am sending the html content and it is displaying as plain text.
This is what i have tried
1)
body="From: [email protected]
To: [email protected]
Subject: MIME Test
Mime-Version: 1.0
Content-Type: text/html
<html>
<body>
This is a test.
</body>
</html>";
echo $body| mail -s "testing purpose" [email protected]
this didn't worked
i put this html in a file called test.html in $tempfile and tried to execute like this
2)
mail -a 'MIME-Version: 1.0' -a 'Content-Type: text/html; charset=iso-8859-1' "server details" "[email protected]" < $tempfile
But nothing has worked, please suggest me regarding this (please only using mail not sendmail/mutt).
Try
echo "<b>HTML Message goes here</b>" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" [email protected]
How to send HTML email using linux command line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With