Email Always Mark as Read

Currently i just sync 1 email to ERPNext account, everything going well, i can receive email through ERPNext, but the problem is, when i received email in ERPNext, the email at gmail account always mark as read, even though i haven’t open it at both ERPNext and Gmail.

Anyone ever had face this issue?

Thanks

2 Likes

Yes. I have seen this also. It is a bug, but I do not think anyone is interested in working on it.

It appears to be related to using IMAP for receiving email. POP mail takes the emails from your gmail (or other) account and places it in you ERPNext inbox leaving no emails in the original source account. (This is a move operation not a copy operation)

IMAP takes a copy of the emails from the source and places the copies in the ERPNext inbox. When the script retrieves the emails from the source mailbox it is marking them read as it takes a copy. The original developer forgot to use the switches for keeping the emails original state during the moves.

It has been a very long time since I manged an IMAP mail transfer, but I do remember there being command switches for keeping the emails in an unread state. I have no idea where to look in the code for this in ERPNext and I am probably far to rusty to be messing with the command syntax these days.

BKM

Hi BKM, yesterday i just solved this issue… Instead of using IMAP, i switch to POP and email didn’t mark as read both in gmail and ERPNext…

But we should tick the POP setting at Gmail to “Enable POP for mail that arrives from now on”

2 Likes

Hi, I am experiencing the same issue that ERPNext is marking emails as read.
Can you please tell me how do you switch to POP instead of IMAP?
Thank you.

Hi AOL, open the Gmail setting at the email you are linked to ERP, look for Forwarding and POP/IMAP then tick the “Enable POP for mail that arrives from now on” Option. Hopefully it help you!

Thank you for your reply.

It’s very helpful.:+1:

1 Like

I am also experiencing the same issue. It’s a new install. I guess the developers still haven’t fixed this? In my case, I cannot use POP because I don’t want it downloading the emails from the server. I want the emails on the server to stay put.

I’m in the same boat, its been a while, strange something this basic has not bee looked at, its quite a draw back ?

Change Email Sync Option to ALL (from UNSEEN). It is misleading, but I checked the code in Frappe and this flag (UNSEEN) actually changes SEEN option of the pulled email.

Frappe will always get new emails regardless of this flag. Of course, this only applies to IMAP

Hi, I’m seeing this issue with IMAP in v14 even with the Email Sync Option set to ALL. Emails are always set to SEEN when the email is pulled. Has anyone else noticed this? I remember it working correctly pretty consistently in v13.

Also, the “use IMAP” option isn’t exposed anymore. There are just “Incoming (POP/IMAP) Settings”.

@ramez where did you find the code for this? Which python file contains the actual email retrieval function?

EDIT: I found the file in ~/frappe-bench/apps/frappe/frappe/email/receive.py

EDIT: I should clarify that “use IMAP”, “use SSL” aren’t exposed when the domain field is filled in due to the conditions set in those fields.

But I think it’s still not working as designed.

I had the same problem. I had originally tied it to my inbox, but that was a mistake. I created a custom folder to use/sync with. Should be an option to not mark as read though.

This is a known bug:

1 Like