<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:inherit;
panose-1:2 11 6 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">I'm trying to get blow Sieve filter to work<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">require ["fileinto", "imap4flags", "mailbox", "body", "envelope",
"vnd.dovecot.pipe", "variables", "vnd.dovecot.execute"];<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">if envelope :matches "To" "*@*" {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> set "recipient" "${0}";<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> set "user" "${1}";<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> set "recip_domain" "${2}";<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">}<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">if envelope :matches "From" "*" {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> set "sender" "${0}";<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">}<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">#Check if recipient is valid user<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">if execute :output "valid_user" "user-verification" "${recipient}"
{<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> if string :matches "${valid_user}" "True" {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> if body :raw :contains ["message/notification"] {<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> setflag "\\Seen";<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> fileinto :create "Notifications";<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> stop;<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1"> }<o:p></o:p></span></p>
<p class="MsoNormal" style="background:#EFF0F1;vertical-align:baseline"><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">}<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">Where </span><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">user-verification</span><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729"> is
an extprogram which calls API and verify user based on email address then returns boolean (as an output to the console).<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">Everything works fine when I will remove </span><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">if
string :matches "${valid_user}" "True"</span><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">statement other way it looks like is not recognizing </span><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">valid_user</span><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">variable.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">When I pipe </span><span style="font-size:10.0pt;font-family:Consolas;color:#242729;border:none windowtext 1.0pt;padding:0in;background:#EFF0F1">valid_user</span><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729"> to
some script just to capture value for that variable it throws an error:<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:cornsilk;vertical-align:baseline"><span style="font-size:11.5pt;font-family:"inherit",serif;color:#242729">error: specified :args item `True?' is invalid.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">Why question mark was added to the variable in this case?<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;vertical-align:baseline">
<span style="font-size:11.5pt;font-family:"Arial",sans-serif;color:#242729">Thoughts?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>