Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ascii' codec can't encode characters in position 4017-4018 #74

Closed
tbm opened this issue May 6, 2021 · 9 comments
Closed

'ascii' codec can't encode characters in position 4017-4018 #74

tbm opened this issue May 6, 2021 · 9 comments

Comments

@tbm
Copy link

tbm commented May 6, 2021

I'm getting the following error:

getmail version 6.15
Copyright (C) 1998-2020 Charles Cazabon and others. Licensed under GNU GPL version 2.
SimpleIMAPSSLRetriever:tbm@cyrius.com@mail.gandi.net:993:
Delivery error (command procmail 29762 error (127, exec of command procmail failed ('ascii' codec can't encode characters in position 4017-4018: ordinal not in range(128))))
  msg 1/6 (12391 bytes), delivery error (command procmail 29762 error (127, exec of command procmail failed ('ascii' codec can't encode characters in position 4017-4018: ordinal not in range(128))))

I can make the email available if someone can tell me how to download it.

@emtiu
Copy link
Contributor

emtiu commented May 6, 2021

The error message looks to me like it's procmail's problem. You could try to use another delivery command/target, and see if getmail can deliver the message then, without procmail onvolved.

(Before you do that, disable deleting of messages in the getmail config to avoid losing it for your main delivery target).

@tbm
Copy link
Author

tbm commented May 6, 2021

The error message looks to me like it's procmail's problem. You could try to use another delivery command/target, and see if getmail can deliver the message then, without procmail onvolved.

Sorry, I forgot to mention that I tried this already. I get the same problem with Maildir.

getmail version 6.15
Copyright (C) 1998-2020 Charles Cazabon and others. Licensed under GNU GPL version 2.
SimpleIMAPSSLRetriever:tbm@cyrius.com@mail.gandi.net:993:
Delivery error (maildir delivery 35888 error (127, maildir delivery process failed ('ascii' codec can't encode characters in position 4017-4018: ordinal not in range(128))))
  msg 1/1 (12391 bytes), delivery error (maildir delivery 35888 error (127, maildir delivery process failed ('ascii' codec can't encode characters in position 4017-4018: ordinal not in range(128))))
  1 messages (12391 bytes) retrieved, 0 skipped from SimpleIMAPSSLRetriever:tbm@cyrius.com@mail.gandi.net:993

@rpuntaie
Copy link
Collaborator

rpuntaie commented May 6, 2021

The message would help me to find a solution. The charset of the mail is obviously not ascii. One can change the charset in Python's email Message class. Maybe I can find a general way to bypass such problems.

To get the mail, one try could be to add the following line in getmail before the line with the string Delivery error:

                        with open(os.path.expanduser('~/failing_mail.txt'),'w') as fm: fm.write(msg.content().as_string())

Else try mbsync. Getting the mail via imaplib directly might have the same problem. You could also use webmail of your provider.

@tbm
Copy link
Author

tbm commented May 10, 2021

@rpuntaie thanks, here's the email:

https://www.cyrius.com/tmp/failing_mail.txt

rpuntaie added a commit that referenced this issue May 10, 2021
@rpuntaie
Copy link
Collaborator

It should work now. Would you give it a try?

@tbm
Copy link
Author

tbm commented May 11, 2021

Yes, it's working now, thank you!

@prinz3nroll3
Copy link

The message would help me to find a solution. The charset of the mail is obviously not ascii. One can change the charset in Python's email Message class. Maybe I can find a general way to bypass such problems.

To get the mail, one try could be to add the following line in getmail before the line with the string Delivery error:

                        with open(os.path.expanduser('~/failing_mail.txt'),'w') as fm: fm.write(msg.content().as_string())

Else try mbsync. Getting the mail via imaplib directly might have the same problem. You could also use webmail of your provider.

Hello,
i have the same issue. but i dont know where i have to add the line. can you give me an hint? thanks

@rpuntaie
Copy link
Collaborator

errorexit = True

@prinz3nroll3
Copy link

errorexit = True

hello,
sorry again for the question. is this the right position?

                 logline += ', deleted'

                except getmailDeliveryError as o:
                    errorexit = True
                    with open(os.path.expanduser('~/failing_mail.txt'),'w') as fm: fm.write(msg.content().as_string())
                    log.error('Delivery error (%s)\n' % o)
                    info += ', delivery error (%s)' % o
                    if options['logfile']:
                        options['logfile'].write('Delivery error (%s)' % o)
                    if options['message_log_syslog']:
                        syslog.syslog(syslog.LOG_ERR,
                                      'Delivery error (%s)' % o)

                except getmailFilterError as o:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants