Email Pulling Error - too many values to unpack from gmail?

I’ve created an email account in ERPNext. Incoming mails aren’t getting pulled into erp from gmail account.


Error Log List:

Title: receive.get_messages
Error:
Error in retrieving email.
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py”, line 238, in retrieve_message
raw, header, ignore = message
ValueError: too many values to unpack

HI All,

Wondering if someone call help us. We need to setup our Email for managing Issues. That is pull messages from gmail to our issue list, but are stuck because of above error.
Wondering if someone can help.

Kindly let us know what other information you will require?
The mail server is gmail. Outgoing is working working fine.
ERPNEXT we have hosted in amazon cloud.

Not sure why incoming is not working and throwing above error.

Bump.

I’m also experiencing this same issue.

ERPNext accepts a message tuple of 3 elements but gmail is sending you more than this…

Thanks for that info @clarkej. Would you be able to share how to best handle this error?

No sign of that issue here so I suggest you add it https://github.com/frappe/erpnext/issues

Issue opened: #12857

I’ve seen this before with spam emails that do not stick to the RFC for email too. But that is using my own inspection server not the Gmail one.

Yes an offensive email may be the problem here.

One option is to login to the gmail server to check into this.

Or see if another mail client Mozilla etc handles it ok and the flow resumes.

“using my own inspection server”

Please elaborate on this Julian?!

thanks

Hi John

Should have been my IMAP mail server

Good old phone autocorrect :grin:

ahh ok

Your spam email suspect here is a good note Julian!

@Nimrod I vote this theory to diagnose so you can close your github issue.

I’ve followed your advice and realized just how little of help the error message is:

Title:
receive.get_messages

Error:

Error in retrieving email.
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 242, in retrieve_message
    raw, header, ignore = message
ValueError: too many values to unpack

We have several email accounts configured as inboxes. But the error message does not indicate from which account the script is pulling messages when this error was encountered. So we had to check all of those inboxes. We only had the date and time of the error log as our usable filter for searching the relevant messages.

The error also doesn’t include at least the email address of the sender. (I’m thinking this item within the tuple can be retrieved separately so that even when the entire tuple is in an unexpected structure/length, at least some useful bit of info is made available in the error log).

Anyway, yes there have been some unsolicited messages there with some attachments. I say unsolicited because we did not ask the senders to send those messages to us. They were just voluntary updates from some of the suppliers we work with.

But these messages are actually welcome. They are updates on products and other items that we might be interested in. Sure, most of the time we ignore them. But from time to time, we get messages just like these that are actually useful to us. And I think many businesses can relate to this.

I agree this error handler could well be changed to log the raw email message, for forensic purposes such as your case.

Of course with open source you have options - I urge you to consider how you might contribute to advance ERPNext. You might wish to work with the email group [ERPNext-Roadmap/Open Discussion] Lets Do Improvement on CRM Module