scanner / as_email_service

A Django app and smtp relay service for working with 3rd party email services and asimap
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

UnicodeEncodeError 'ascii' codec can't encode character '\xa9' in position 5: ordinal not in range(128) #126

Closed scanner closed 8 months ago

scanner commented 8 months ago

Problems dispatching email we received.

https://github.com/scanner/as_email_service/blob/main/app/as_email/models.py#L319

        del msg["X-PM-Message-Stream"]
        msg["X-PM-Message-Stream"] = "outbound"

        smtp_server, port = self.provider.smtp_server.split(":")
        smtp_client = smtplib.SMTP(smtp_server, int(port))
        try:
            smtp_client.starttls()
            smtp_client.login(token, token)
            smtp_client.send_message(
                msg, from_addr=email_from, to_addrs=rcpt_tos
            )

so.. we got a message with binary in it, but smtplib was not able to handle it.

scanner commented 8 months ago

https://apricot-systematic.sentry.io/issues/4927484180/?alert_rule_id=14754796&alert_timestamp=1706605226029&alert_type=email&environment=production&notification_uuid=47f813da-ee97-4de6-aa4c-ae657bd3b7dc&project=4506107525005312&referrer=alert_email

scanner commented 8 months ago

Fixed in GH-126

scanner commented 8 months ago

Need to add UTF-8 to our encodings list.