How to use sieve to send HTML email

1.5k Views Asked by At

I am using sieve to send external notification emails about our internal emails.

if header :matches "X-Forward-To" "*" {
   set "forwardTo" "${1}";
   set :encodeurl "message" "Message";
   notify :from "[email protected]"
     :importance "1"
     :message "You've got mail!"
     "mailto:${forwardTo}?body=${message}";
   }
}

This works great until there are any html tags in the message. Then I receive plain-text emails with tags written out. Is there another function I can use other than notify? Is there a switch in notify? How do I use sieve to send HTML emails?

EDIT: To be clear, I don't simply want to redirect or forward the initial message; I want to send a notification with its own message.

EDIT 2: It looks like maybe it's just intervening mail exchange servers that are messing with me. The content-type: text/html tag might work otherwise.

1

There are 1 best solutions below

2
On

If it's going to work at all, you'd need to include the Content-Type header in the mailto URL, for something like this:

set :encodeurl "message" "Message <i>with HTML</i>";
notify :from "[email protected]"
  :importance "1"
  :message "You've got mail!"
  "mailto:${forwardTo}?Content-Type=text/html&body=${message}";

If you're running into issues doing that, then probably sending HTML emails via notifications is not handled by your mail setup or the mail servers en route.