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

Problem with non-ascii characters in e-mail #30

Open
trgtylcnky opened this issue Apr 7, 2017 · 2 comments
Open

Problem with non-ascii characters in e-mail #30

trgtylcnky opened this issue Apr 7, 2017 · 2 comments

Comments

@trgtylcnky
Copy link

Plugin works well but when my e-mail title contains ü, ş, ç etc. it gives this error:

2017-04-07 08:49:20,465 - octoprint.plugins.emailnotifier - ERROR - Email notification error: 'ascii' codec can't encode characters in position 16-18: ordinal not in range(128)
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_emailnotifier/__init__.py", line 73, in on_event
    mailer.send(to=emails, subject=title, contents=content, validate_email=False)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/yagmail/yagmail.py", line 107, in send
    msg = self._prepare_message(addresses, subject, contents, attachments, headers)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/yagmail/yagmail.py", line 230, in _prepare_message
    has_included_images, content_objects = self._prepare_contents(contents)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/yagmail/yagmail.py", line 298, in _prepare_contents
    content_object = self._get_mime_object(content)
  File "/home/pi/oprint/local/lib/python2.7/site-packages/yagmail/yagmail.py", line 368, in _get_mime_object
    content_name = os.path.basename(str(content_string))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 16-18: ordinal not in range(128)

@anoved
Copy link
Owner

anoved commented Apr 8, 2017

Thanks for the feedback. I apologize for this problem as internationalization is important to me. Unfortunately I have not been able to maintain this plug-in recently, but figuring this out will be a top priority when and if I do get a chance to work on it.

@anoved
Copy link
Owner

anoved commented Apr 20, 2017

It looks like this may be a known issue with yagmail that has been fixed: kootenpv/yagmail#32

If possible, try updating your OctoPrint installation to use the current distribution of yagmail with:

~/oprint/bin/pip install -U yagmail

I am using the current yagmail (0.6.161) and can't reproduce this problem - characters such as üşç come through in the email title OK. Let me know if updating yagmail helps you as well or not.

@anoved anoved added the email label Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants