Sieve-Example:HTML Autoresponder: Difference between revisions

From AAISP Support Site
mNo edit summary
Line 35: Line 35:


==Editing this in Roundcube==
==Editing this in Roundcube==
Roundcube has a 'wizard' or WYSIWYG editor, that allows you to create filters using a form. However, for this do you can't use this editor, you have to edit the sieve script by hand, Roundcube lets you do this though.
Roundcube has a 'wizard' or semi-WYSIWYG editor, that allows you to create filters using a form. However, for this example it won't understand all the syntax so you can't use this editor, you have to edit the sieve script by hand, Roundcube lets you do this though.


In Roundcube, go to Settings, Filters.
In Roundcube, go to Settings, Filters.
Line 43: Line 43:
You can paste in the script above.
You can paste in the script above.


You can edit the HTML, if you add any quotes (") in the HTML then you will need to escape it by using: \"
You can edit the subject line and the HTML to your liking, if you add any quotes (") in the HTML then you will need to escape it by using: \" - adding images is probably going to be problematic, don't bother trying! Inline css will probably be ok.


Clicking save should say that it's updated, if you get errors, then the syntax you have won't be correct, but the example above works.
Clicking save should say that it's updated, if you get errors, then the syntax you have won't be correct, but the example above works.

Revision as of 12:36, 26 July 2022

Sometimes you may want to sent an autoresponder, eg an out of office, or an automatic reply for some other reason as a HTML message.

You can use the following as an example, to format the response:

require ["vacation","variables"];
# rule:[html auto responder reply]
if true
{
    if header :matches "subject" "*" {
      set "subject" "${1}";
    }
    vacation :subject "Automatic reply with HTML information. Re ${subject}" 
    :mime text:
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE html><html><head></head>
<body>
<h1>Thank you</h1>
<hr>
<b>I am away</b>
</body>
</html>
;
}


This will:

  • Match any incoming email
  • Put the subject line in to a variable
  • Reply back to the sender with a modified subject line
  • Include HTML in the email

Editing this in Roundcube

Roundcube has a 'wizard' or semi-WYSIWYG editor, that allows you to create filters using a form. However, for this example it won't understand all the syntax so you can't use this editor, you have to edit the sieve script by hand, Roundcube lets you do this though.

In Roundcube, go to Settings, Filters.

You can create a filter if you've not got one, but then you need to edit it manually - you click the cog at the bottom, and click 'edit filter set'

You can paste in the script above.

You can edit the subject line and the HTML to your liking, if you add any quotes (") in the HTML then you will need to escape it by using: \" - adding images is probably going to be problematic, don't bother trying! Inline css will probably be ok.

Clicking save should say that it's updated, if you get errors, then the syntax you have won't be correct, but the example above works.

This WON'T include any signature, but you can add what ever HTML you like.

If you later edit the filter with Roundcube be sure to use the 'edit filter set' link as otherwise the code will get altered and not work.

Roundcube-sieve-html-responder.png