1

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 "[email protected]" -s "subject content goes here" -S smtp=smtp://x.x.x.x [email protected]

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
  • 2
    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, 2018 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, 2018 at 1:54

1 Answer 1

0

Try:

echo -e "Body content goes here ..." | mailx -v \
-r "[email protected]" \
-s "subject content goes here" \
-S smtp=smtp://x.x.x.x [email protected] \
-S "Content-Type: text/html"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .