[Dovecot] Sieve notify messages

Stephan Bosch stephan at rename-it.nl
Sun Feb 5 17:46:41 EET 2012


On 2/5/2012 4:00 PM, Andreas Muehlemann wrote:
> Hi All
>
> I'm using dovecot 2.0.16 with the pigeonhole plugin 0.25.
>
> I'm trying to use the notifiy mechanism from sieve to send 
> notifications when a mail arrives in the mailbox. The message is 
> checked to be a 8bit message, otherwise it is replaced by the default 
> message "Notification of new message." How can I create a 8bit message 
> body within the sieve script that is accepted by the notification 
> process?
>
> e.g.
> notify
>     :message "Subject: ${subject}"
>     "mailto:email at domain.com";
>
> Do I have to put the message body into the :message string? Or how can 
> I define a custom message body that is accepted by notify?

If I understand you correctly, the following should be the solution for 
your issue:

<SCRIPT>
require "enotify";
require "variables";
require "encoded-character";

# Percent-encode the UTF-8 message
# (I'm using encoded-character here, but you can use UTF8 directly of 
course)
set :encodeurl "message" "In ${unicode:d6}sterreich m${unicode:e4}ht 
Herr M${unicode:fc}ller seinen Rasen ${unicode:fc}brigens auch 
${unicode:fc}ber dem Durchschnitt schnell.";

# Send the notification
notify :message "Herr M${unicode:fc}ller m${unicode:e4}ht seinen Rasen" 
"mailto:user at example.com?body=${message}";
</SCRIPT>

This sends the following message:

<MESSAGE>
X-Sieve: Pigeonhole Sieve 0.3.0
Message-ID: <dovecot-sieve-1328456217-863910-0 at host.example.com>
Date: Sun, 05 Feb 2012 16:36:57 +0100
Subject: Herr =?utf-8?q?M=C3=BCller_m=C3=A4ht?= seinen Rasen
From: Postmaster <postmaster at example.com>
To: user at example.com
Auto-Submitted: auto-notified; owner-email="234234234234 at ext2.domain.tld"
Precedence: bulk
X-Priority: 3 (Normal)
Importance: Normal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In Österreich mäht Herr Müller seinen Rasen übrigens auch über dem 
Durchschnitt schnell.
</MESSAGE>

Regards,

Stephan



More information about the dovecot mailing list