Encoding errors in Gmail?

Caleb Rogers caleb at calebjay.com
Mon Sep 11 09:29:11 BST 2023


This is super weird, you're having an identical issue to me, 
including from a sendgrid address:

ERROR: UID 126179 
(<ZF3lf1bGTw-Ct-Y9A15WlqUQ3BukrDdPHg-173.82.166.30 at ismtpd0003p1iad1.sendgrid.net>) 
has defects preventing it from being processed!
  UnicodeEncodeError: 'ascii' codec can't encode characters in 
  position 434-435: ordinal not in range(128)

I've been meaning to post on stackoverflow or here about it but 
just haven't gotten around to it

It prevents me from keeping offlineimap running continously 
because it causes a crash.

I also wasn't able to find the offending email on my gmail server 
anywhere, at least not using gmail's search tools (or other 
applications), because if I could I'd just delete it and move on.

Jonathan Whitehead <jonathan.whitehead at gmail.com> writes:

> I'm running imap in a docker container (maxkratz/onlineimap), 
> after trying repeatedly to run it in bare debian.  I'm backing 
> up from
> Gmail.  In the container, offlineimap -V shows:
>
> offlineimap v8.0.0, imaplib2 v3.05, Python v3.10.6, OpenSSL 
> 3.0.2 15 Mar 2022
>
> The docker container gets me further, but in both cases, 
> offlineimap eventually errors and closes after hitting 5-10 
> encoding errors, such
> as:
>
> ERROR: UID 140848 
> (<ZF3lf1bGTw-Ct-Y9A5ZZl3Q6MXODdPHg-212.129.51.36 at ismtpd0003p1iad1.sendgrid.net>) 
> has defects preventing it from being processed!
>
>   UnicodeEncodeError: 'ascii' codec can't encode characters in 
>   position 434-435: ordinal not in range(128)
>
> Traceback:
>
>   File "/usr/share/offlineimap3/offlineimap/folder/Base.py", 
>   line 810, in copymessageto
>
>     message = self.getmessage(uid)
>
>   File "/usr/share/offlineimap3/offlineimap/folder/Gmail.py", 
>   line 69, in getmessage
>
>     data = self._fetch_from_imap(str(uid), self.retrycount)
>
>   File "/usr/share/offlineimap3/offlineimap/folder/IMAP.py", 
>   line 930, in _fetch_from_imap
>
>     raise OfflineImapError(
>
> This seems to be related to UTF-8 encoding somehow. My next step 
> would be to look at these message (or figure out a fix). But how 
> do I determine which message is causing the failure?  UID 140848 
> doesn't appear in my maildir yet, and Gmail does not see the 
> sendgrid address when I search.
>
> _______________________________________________
> OfflineIMAP-project mailing list: 
> OfflineIMAP-project at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/offlineimap-project
>
> OfflineIMAP homepages:
> - https://github.com/OfflineIMAP
> - http://offlineimap.org



More information about the OfflineIMAP-project mailing list