You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/09/29 07:55:18 UTC

[GitHub] [superset] Kingflyinger commented on issue #10546: When the name of the email attachment is Chinese, the name of the attachment received by the email client is garbled

Kingflyinger commented on issue #10546:
URL: https://github.com/apache/superset/issues/10546#issuecomment-929930930


   @wzJudy. 
   I met the same problem and fixed it.
   superset/utils/core.py
   
   
       # Attach any files passed directly
       for name, body in (data or {}).items():
           att = MIMEApplication(
                   body,
                   Name=name,
                   )
           att.add_header('Content-Disposition', 'attachment',filename=('gbk', '', name))
           msg.attach(att)
           
           '''
           msg.attach(
               MIMEApplication(
                   body, Content_Disposition="attachment; filename='%s'" % name, Name=name
               )
           )
           '''
       # Attach files by reading them from disk
       for fname in files or []:
           basename = os.path.basename(fname)
           with open(fname, "rb") as f:
               att = MIMEApplication(
                       f.read(),
                       Name=basename
                   )
               att.add_header('Content-Disposition', 'attachment',filename=('gbk', '', basename))
               msg.attach(att)
               '''
               msg.attach(
                   MIMEApplication(
                       f.read(),
                       Content_Disposition="attachment; filename='%s'" % basename,
                       Name=basename,
                   )
               )
               '''
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org