Gmail IAMP SuiteCRM - Email mark as read

I configure the Gmail account as group email in SuiteCRM 7.5 edition using IMAP. After fetching email from Gmail, script is mark email as read in Gmail. Is this bug or anything related to setting issue. Your help highly appreciate.

Hi, did you find a solution or a workaround for this?

It was HACK solution. I changed code in below file.

modules/InboundEmail/InboundEmail.php

http://www.php.net/manual/en/function.imap-body.php
FT_PEEK - Do not set the \Seen flag if not already set
FT_PEEK pass for unread message.

File Path

modules/InboundEmail/InboundEmail.php

function getMessageTextFromSingleMimePart($msgNo,$section,$structure)
#$msgPartTmp = imap_fetchbody($this->conn, $msgNo, $section);
$msgPartTmp = imap_fetchbody($this->conn, $msgNo, $section, FT_PEEK); // Add this new line

function getMessageText($msgNo, $type, $structure, $fullHeader,$clean_email=true, $bcOffset = ā€œā€) {
// now get actual body contents
#$text = imap_body($this->conn, $msgNo);
$text = imap_body($this->conn, $msgNo, FT_PEEK); // Added new line

function importOneEmail($msgNo, $uid, $forDisplay=false, $clean_email=true) {
#$r = imap_setflag_full($this->conn, $msgNo, ā€˜\SEENā€™); // Comment out this line

Thanks
Dipesh

SuiteCRM Developer

1 Like

Wow thankā€™s thatā€™s great!!! It seems to work!!!

Oopsā€¦ Not reallyā€¦ It didnā€™t work for meā€¦ Thank you anywayā€¦ Maybe there is another script that fetches messages every X minutes, without having to enter Email module. Does anybody know anything about that?

SOLVED!!! By the genius abuelodelanada!!! Hereā€™s the PR: https://github.com/salesagility/SuiteCRM/pull/6237

1 Like

When i check modules/InboundEmail/InboundEmail.php file, There are two commented line Which are;

5507 // for display - donā€™t touch server files?
5508 //imap_setflag_full($this->conn, $msgNo, ā€˜\UNSEENā€™);

5206 // for display - donā€™t touch server files?
5207 //imap_setflag_full($this->conn, $msgNo, ā€˜\UNSEENā€™);

If i remove comment, is it working?