Community Discussions and Support
subject-search with python

David confirms the issue and has now added a fix for it in the upcoming maintenance release. Thanks for pointing it out! 

<p>David confirms the issue and has now added a fix for it in the upcoming maintenance release. Thanks for pointing it out!<span style="font-size: 10pt;"> </span></p>

I try to find out, why i get a strange answer of the imapserver from Mercury. A python script checks mails and searches for a part of the mail subject. Here the shortened imap session-log:

 

01: << NPNG1 OK LOGIN completed.<cr><lf>

02: >> NPNG2 SELECT 0<cr><lf>

03: << * 1 EXISTS<cr><lf>

04: << * 0 RECENT<cr><lf>

05: << * FLAGS (\Deleted \Draft \Seen \Answered)<cr><lf>

06: << * OK [UNSEEN 1] First unread message<cr><lf>

07: << * OK [UIDVALIDITY 1500594200] UID Validity<cr><lf>

08: << * OK [UIDNEXT 2] Predicted next UID<cr><lf>

09: << * OK [PERMANENTFLAGS (\Deleted \Draft \Seen \Answered)] Settable message flags<cr><lf>

10: << NPNG2 OK [READ-WRITE] SELECT completed.<cr><lf>

11: >> NPNG3 UID SEARCH (SENTSINCE 20-Jul-2017 SUBJECT "Mercury")<cr><lf>

12: << * SEARCH

13: << <cr><lf>

14: << NPNG3 OK SEARCH complete.<cr><lf> 

 

Login and selecting the imap-folder "0" are okay until line 11. The problem seems to be either the search string in line 11 or the imapserver is waiting for something. Line 6 of the log lists an unseen message. The string "Mercury" is a part of the mail subject. Therefor line 12 should display an other answer.

&lt;p&gt;I try to find out, why i get a strange answer of the imapserver from Mercury. A python script checks mails and searches for a part of the mail subject. Here the shortened imap session-log:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;01: &amp;lt;&amp;lt; NPNG1 OK LOGIN completed.&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;02: &amp;gt;&amp;gt; NPNG2 SELECT 0&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;03: &amp;lt;&amp;lt; * 1 EXISTS&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;04: &amp;lt;&amp;lt; * 0 RECENT&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;05: &amp;lt;&amp;lt; * FLAGS (\Deleted \Draft \Seen \Answered)&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;06: &amp;lt;&amp;lt; * OK [UNSEEN 1] First unread message&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;07: &amp;lt;&amp;lt; * OK [UIDVALIDITY 1500594200] UID Validity&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;08: &amp;lt;&amp;lt; * OK [UIDNEXT 2] Predicted next UID&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;09: &amp;lt;&amp;lt; * OK [PERMANENTFLAGS (\Deleted \Draft \Seen \Answered)] Settable message flags&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;10: &amp;lt;&amp;lt; NPNG2 OK [READ-WRITE] SELECT completed.&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;11: &amp;gt;&amp;gt; NPNG3 UID SEARCH (SENTSINCE 20-Jul-2017 SUBJECT &quot;Mercury&quot;)&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;12: &amp;lt;&amp;lt; * SEARCH&lt;/p&gt;&lt;p&gt;13: &amp;lt;&amp;lt; &amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&lt;/p&gt;&lt;p&gt;14: &amp;lt;&amp;lt; NPNG3 OK SEARCH complete.&amp;lt;cr&amp;gt;&amp;lt;lf&amp;gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;Login and selecting the imap-folder &quot;0&quot; are okay until line 11. The problem seems to be either the search string in line 11 &lt;/span&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;or the imapserver is waiting for something. Line 6 of the log lists an unseen message. The string &quot;Mercury&quot; is a part of the mail subject. Therefor line 12 should display an other answer.&lt;/span&gt;&lt;/p&gt;

Please copy all headers from the CNM file with the message that wasn't found and we'll check it out!

&lt;p&gt;Please copy all headers from the CNM file with the message that wasn&#039;t found and we&#039;ll check it out!&lt;/p&gt;

I had a long telnet session last night and i found the problem. According to thread http://community.pmail.com/forums/post/138.aspx the command SENTSINCE (part 6.4.4) should be:

SENTSINCE <date>
         Messages whose [RFC-2822] Date: header (disregarding time and
         timezone) is within or later than the specified date.

But SENTSINCE searches only for later than the specified date:

SEARCH SENTSINCE 22-Jul-2017

* SEARCH 4711

OK SEARCH complete.


SEARCH SENTSINCE 23-Jul-2017

* SEARCH <NUL>

OK SEARCH complete.

&lt;p&gt;I had a long telnet session last night and i found the problem. According to thread&amp;nbsp;http://community.pmail.com/forums/post/138.aspx the command SENTSINCE (part 6.4.4) should be:&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-family: &#039;courier new&#039;, courier; font-size: 12.096px;&quot;&gt;SENTSINCE &amp;lt;date&amp;gt;&lt;/span&gt;&lt;br style=&quot;font-family: &#039;courier new&#039;, courier; font-size: 12.096px;&quot;&gt;&lt;span style=&quot;font-family: &#039;courier new&#039;, courier; font-size: 12.096px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Messages whose [RFC-2822] Date: header (disregarding time and&lt;/span&gt;&lt;br style=&quot;font-family: &#039;courier new&#039;, courier; font-size: 12.096px;&quot;&gt;&lt;span style=&quot;font-family: &#039;courier new&#039;, courier; font-size: 12.096px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timezone) is within or later than the specified date.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;But SENTSINCE searches only for later than the specified date:&lt;/p&gt; &lt;p&gt;SEARCH SENTSINCE 22-Jul-2017&lt;/p&gt;&lt;p&gt;* SEARCH 4711&lt;/p&gt;&lt;p&gt;OK SEARCH complete.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;SEARCH SENTSINCE 23-Jul-2017&lt;/p&gt;&lt;p&gt;* SEARCH &amp;lt;NUL&amp;gt;&lt;/p&gt;&lt;p&gt;OK SEARCH complete.&lt;/p&gt;&lt;b style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 13px; color: rgb(102, 102, 102); font-family: &#039;Trebuchet MS&#039;, Arial, sans-serif; background-color: rgb(252, 253, 254);&quot;&gt; &lt;span style=&quot;margin: 0px; padding: 0px; border: 0px; font-size: 13px; font-family: &#039;Trebuchet MS&#039;, Arial, sans-serif; background-color: rgb(252, 253, 254); color: rgb(255, 0, 0);&quot;&gt;&lt;/span&gt;&lt;/b&gt;

Date: Sun, 23 Jul 2017 10:35:56 +0200

[add]
UID SEARCH (SENTSINCE 23-Jul-2017 SUBJECT "Mercury")

* SEARCH <NUL>

OK SEARCH complete.

UID SEARCH (SENTSINCE 22-Jul-2017 SUBJECT "Mercury")

* SEARCH 12345

OK SEARCH complete.


[add2]
Now a retest with SENTON:
 
UID SEARCH (SENTON 23-Jul-2017 SUBJECT "Mercury")
* SEARCH 12345
OK SEARCH complete.
&lt;pre&gt;Date: Sun, 23 Jul 2017 10:35:56 +0200&lt;/pre&gt;&lt;pre&gt; &lt;/pre&gt;&lt;pre&gt;[add]&lt;/pre&gt;&lt;pre&gt;UID SEARCH (SENTSINCE 23-Jul-2017 SUBJECT &quot;Mercury&quot;) * SEARCH &amp;lt;NUL&amp;gt; OK SEARCH complete. UID SEARCH (SENTSINCE 22-Jul-2017 SUBJECT &quot;Mercury&quot;) * SEARCH 12345 OK SEARCH complete. &lt;/pre&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;[add2]&lt;/div&gt;&lt;div&gt;Now a retest with SENTON:&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;UID SEARCH (SENTON 23-Jul-2017 SUBJECT &quot;Mercury&quot;)&lt;/div&gt;&lt;div&gt;* SEARCH 12345&lt;/div&gt;&lt;div&gt;OK SEARCH complete.&lt;/div&gt;
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft