Sieve-Example:Notify: Difference between revisions

From AAISP Support Site
mNo edit summary
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
Send a notification email to another mailbox when the mailbox gets an email:
Send a notification email to another mailbox when the mailbox gets an email:


[[File:Sieve-roundcube-notify.png]]
[[File:Sieve-roundcube-notify.png|none|frame|Roundcube screenshot for sending a notification email to another address]]


If you can edit the sieve filter manually, then you can also get the Sender and add that to the subject line:
<syntaxhighlight>

<syntaxhighlight lang="python">
# rule:[notify]
# rule:[notify]
if header :matches "subject" "*"
if header :matches "Subject" "*"
{
{
set "subject" "${1}";
set "subject" "${1}";
notify :importance "2" :message "[Notification] ${subject}" "mailto:someone@example.com";
}
}

if header :matches "From" "*"
{
set "from" "${1}";
}
notify :importance "2" :message "[Notification] ${from}: ${subject}" "mailto:someone@example.com";

</syntaxhighlight>
</syntaxhighlight>


This sets a variable of the subject, and then sends an email to another mailbox using the subject line.
This sets a variable of the subject, and then sends an email to another mailbox using the subject line.



[[Category:Sieve]]

Latest revision as of 12:19, 26 July 2022

Send a notification email to another mailbox when the mailbox gets an email:

Roundcube screenshot for sending a notification email to another address

If you can edit the sieve filter manually, then you can also get the Sender and add that to the subject line:

# rule:[notify]
if header :matches "Subject" "*"
{
	set "subject" "${1}";
}

if header :matches "From" "*"
{
	set "from" "${1}";
}
notify :importance "2" :message "[Notification] ${from}: ${subject}" "mailto:someone@example.com";

This sets a variable of the subject, and then sends an email to another mailbox using the subject line.