[Vtigercrm-developers] MailScanner marks mail as read

Stefan Warnat ich at stefanwarnat.de
Fri Dec 7 01:47:43 PST 2012


Hy,

Today, and yesterday, I had search an error, which is a great problem of 
one of my clients, and if I think about it, probably for others, too. 
(And here comes the solution/bugfix, because 6.0 don't fix this at this 
moment)

If I configure the MailScanner with an Google Mail Account, it set the 
\SEEN flag on every mail, it scanned.
But this is not an error of google mail, because they follow the IMAP 
specification in this point.

This specification say, that every fetch of the body set the read state, 
if the body request is done without the PEEK flag.

Vtiger fetch the maibody with the imap_body or imap_fetchbody function 
and don't set this PEEK flag.

I think this is a bug, because there are a special option to set the 
\SEEN flag in mailscanner, after scanning.

You have to change only two lines to change this behaviour. Later, I 
will upload an patch into trac, too.
In file modules/Settings/MailScanner/core/MailRecord.php there are the 
function calls

             imap_fetchbody($imap,$messageid,$partno):  // multipart
             imap_body($imap,$messageid);               // not multipart

and you should add the last parameter:

             imap_fetchbody($imap,$messageid,$partno, FT_PEEK):  // 
multipart
             imap_body($imap,$messageid, FT_PEEK);               // not 
multipart

This sould be work also with all correct configured mailservers and 
don't set the read state!

Stefan

---
*Web*: http://vtiger.stefanwarnat.de <http://www.stefanwarnat.de>
*Xing*: https://www.xing.com/profile/Stefan_Warnat2
*eMail*: ich at stefanwarnat.de <mailto:ich at stefanwarnat.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20121207/a9f17472/attachment.html 


More information about the vtigercrm-developers mailing list