[GH-ISSUE #1518] Can't send mail with an attachment containing non-ascii characters in the file name #1197

Closed
opened 2026-02-27 11:15:49 +03:00 by kerem · 6 comments
Owner

Originally created by @lefta on GitHub (Jul 6, 2018).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1518

Impacted versions

  • Modoboa: 1.10.5
  • Installer used: No
  • Python version: 3.5
  • Webserver: Nginx

Steps to reproduce

Send a mail with an attachment containing non-ascii characters in the filename from the webmail. There is no problem with filenames containing only ascii characters and other mail clients (tested with GMail Android).

Current behavior

Mail sending fails with error code 500 and contents :

"'bytes' object has no attribute 'encode'"

Expected behavior

Mail sent successfully 😄

Additional details

I really need it to be working, but this is not a problem to fix it myself. How can I install a local (not pip) version, if possible not having to build a full mail stack so I can start to hack the code ? Would git clone be enough ? How would I install plugins in this case ? (I'm especially thinking about the webmail plugin, as it seems to be the cause of the breakage)

Originally created by @lefta on GitHub (Jul 6, 2018). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1518 # Impacted versions * Modoboa: 1.10.5 * Installer used: No * Python version: 3.5 * Webserver: Nginx # Steps to reproduce Send a mail with an attachment containing non-ascii characters in the filename from the webmail. There is no problem with filenames containing only ascii characters and other mail clients (tested with GMail Android). # Current behavior Mail sending fails with error code 500 and contents : ``` "'bytes' object has no attribute 'encode'" ``` # Expected behavior Mail sent successfully :smile: # Additional details I **really** need it to be working, but this is not a problem to fix it myself. How can I install a local (not pip) version, if possible not having to build a full mail stack so I can start to hack the code ? Would `git clone` be enough ? How would I install plugins in this case ? (I'm especially thinking about the webmail plugin, as it seems to be the cause of the breakage)
kerem closed this issue 2026-02-27 11:15:49 +03:00
Author
Owner

@tonioo commented on GitHub (Jul 8, 2018):

@lefta Please provide a full stack trace.

<!-- gh-comment-id:403282346 --> @tonioo commented on GitHub (Jul 8, 2018): @lefta Please provide a full stack trace.
Author
Owner

@lefta commented on GitHub (Jul 9, 2018):

I would like to, but I could not get one. I tried to activate debug mode and check the answer body, but still no backtrace. How may I get one ? I'm using uwsgi if this is relevant. (sorry, I'm new to Modoboa and python servers)

<!-- gh-comment-id:403475142 --> @lefta commented on GitHub (Jul 9, 2018): I would like to, but I could not get one. I tried to activate debug mode and check the answer body, but still no backtrace. How may I get one ? I'm using uwsgi if this is relevant. (sorry, I'm new to Modoboa and python servers)
Author
Owner

@tonioo commented on GitHub (Jul 9, 2018):

Have you reloaded uwsgi?

<!-- gh-comment-id:403530054 --> @tonioo commented on GitHub (Jul 9, 2018): Have you reloaded uwsgi?
Author
Owner

@lefta commented on GitHub (Jul 9, 2018):

Yes I did.

EDIT: I have time to make tests right now, so I checked with multiple file formats. Here are the results :

  • JPG: pass
  • PDF: pass
  • ODT: fail
  • DOCX: fail

All these formats are binary files, so I wonder what is the difference ?

EDIT 2 : Found the difference. The error happens when sending a file with non-ascii ( I guess ? ) characters. At least Modele.docx is sent correctly, but Modèle.docx triggers the error. I'm updating the title.

EDIT 3 : Tested with GMail on Android, the mail was sent successfully. I think this is fair to guess that the problem comes from the webmail ? Should I open a new bug report in the webmail project ?

<!-- gh-comment-id:403542137 --> @lefta commented on GitHub (Jul 9, 2018): Yes I did. EDIT: I have time to make tests right now, so I checked with multiple file formats. Here are the results : * JPG: pass * PDF: pass * ODT: fail * DOCX: fail All these formats are binary files, so I wonder what is the difference ? EDIT 2 : Found the difference. The error happens when sending a file with non-ascii ( I guess ? ) characters. At least `Modele.docx` is sent correctly, but `Modèle.docx` triggers the error. I'm updating the title. EDIT 3 : Tested with GMail on Android, the mail was sent successfully. I think this is fair to guess that the problem comes from the webmail ? Should I open a new bug report in the webmail project ?
Author
Owner

@tonioo commented on GitHub (Jul 10, 2018):

@lefta yes please.

<!-- gh-comment-id:403750579 --> @tonioo commented on GitHub (Jul 10, 2018): @lefta yes please.
Author
Owner

@lefta commented on GitHub (Jul 10, 2018):

Done: modoboa/modoboa-webmail#165

<!-- gh-comment-id:403777816 --> @lefta commented on GitHub (Jul 10, 2018): Done: modoboa/modoboa-webmail#165
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1197
No description provided.