Sieve notify variables not working with body?

Stephan Bosch stephan at rename-it.nl
Sun Dec 9 23:10:42 EET 2018


Op 16/11/2018 om 20:36 schreef Bambero:
>
> Thanks, now it works.
> But it seems that :message string (of notify command) is limited to 
> 255 chars.
> Is there any chance to change limit to 512 ?

Hmm, you are right:

https://github.com/dovecot/pigeonhole/blob/master/src/lib-sieve/plugins/enotify/mailto/ntfy-mailto.c#L49

That is quite a low limit, especially when the message is in e.g. 
Japanese symbols. We got complaints about a similar problem a while back 
for the vacation extension. I can fix notify as well when I get to work 
on that ticket.

Still, I would not recommend putting the body in the subject of the 
notification message (which is what ":message" does). Instead, you could 
use the "body" header field of the mailto URL to put your message in the 
body instead.


Regards,


Stephan.



>
> require 
> ["body","enotify","variables","foreverypart","mime","extracttext"];
>
> foreverypart
> {
>     if header :mime :type :is "Content-Type" "text"
>     {
>         extracttext :first 512 "body";
>         break;
>     }
> }
>
> if not header :contains "subject" "*"
> {
>     notify :importance "3" :message "${body}" "mailto:test at example.com 
> <mailto:test at example.com>";
> }
>
> On Fri, Nov 16, 2018 at 2:53 PM Stephan Bosch <stephan at rename-it.nl 
> <mailto:stephan at rename-it.nl>> wrote:
>
>
>
>     Op 15-11-2018 om 23:54 schreef Bambero:
>     > Hi,
>     >
>     > I want to send notification like this:
>     >
>     > if body :text :matches "*" {
>     >            notify :importance "3"
>     >                :message "[NOTIFY] ${1}"
>     >                "mailto:test at example <mailto:test at example>
>     <mailto:test at example <mailto:test at example>>,com";
>     > }
>     >
>     > The notification works but the variable ${1} seems to be empty.
>     >
>     > But in this case:
>     >
>     > if header :matches "Subject" "*" {
>     >            notify :importance "3"
>     >                :message "[NOTIFY] ${1}"
>     >                "mailto:test at example <mailto:test at example>
>     <mailto:test at example <mailto:test at example>>,com";
>     > }
>     >
>     > Everything works correct.
>
>     https://tools.ietf.org/html/rfc5173#section-6
>
>     Use the extracttext extension instead:
>
>     https://tools.ietf.org/html/rfc5703#section-7
>
>     Regards,
>
>     Stephan.
>


More information about the dovecot mailing list