0

I have installed the mailx , on Red Hat Enterprise Linux Server release 7.2 Am able to send the mail successfully, with following command.

echo -e "Body content goes here ..." | mailx -v -r "sendermail_id@x.com" -s "subject content goes here" -S smtp=smtp://x.x.x.x receivermail_id@.com

Above command sends mail with plain text in the body

I want a command wherein i can send mail with html type content in the mail body. like bold letters, font colors......How do i do??? any help will be appreciated.

3
  • 1
    See this answer for full details. RHEL 7.2 ships Heirloom mailx, so there's no convenient way to send HTML mail. The answer linked to has a small recipe, setting editheaders=1 and using a short script to insert a text/html Content-Type in the e-mail headers. It's really hacky...
    – filbranden
    Mar 26 '18 at 5:55
  • 1
    mailx is a nightmare with trying to send html emails. I just went through fighting this battle a few weeks ago. I highly suggest using something like mutt or instead.
    – thermite
    Aug 26 '18 at 1:54
0

Try:

echo -e "Body content goes here ..." | mailx -v \
-r "sendermail_id@x.com" \
-s "subject content goes here" \
-S smtp=smtp://x.x.x.x receivermail_id@.com \
-S "Content-Type: text/html"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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