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 "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.

  • 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 '18 at 05:55
  • https://unix.stackexchange.com/users/281844/filipe-brandenburger thanku – sachin_ghagare Jul 22 '18 at 11:08
  • 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 01:54

1 Answers1

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"