-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Escaping of recipient name #281
base: master
Are you sure you want to change the base?
Conversation
1 similar comment
Thanks for the contrib! However, it seems to me that these characters should be escaped rather than removed. It's 2020, we have UTF-8 these days and it happens to be that most of the world doesn't live in ASCII anymore. ;) |
Oh! But this isn't about Unicode or ascii. It is about characters like @ or . in the recipient's name, when these characters typically go in the recipient's address. You can try it and see. |
Of course you didn't do it because you're in love with ASCII. ;)
In python 3 there's a dedicated function to make recipient headers.
https://docs.python.org/3/library/email.utils.html
You might need to backport this until Django 1.11 support will be dropped in April.
A 7 de janeiro de 2020 16:04:18 CET, newearthmartin <notifications@github.com> escreveu:
…I didnt do this because I love ASCII, I did it because it was throwing
an exception when sending emails in production (in 2019 😉). But it
didn't occur to me to escape. Will make some tests and see if escaping
works. >
>
-- >
You are receiving this because you commented.>
Reply to this email directly or view it on GitHub:>
#281 (comment)
--
Enviado a partir do meu dispositivo Android com o K-9 Mail. Peço desculpa pela brevidade.
|
In some cases, the subscription.name will contain special characters that cause the outgoing email to fail such as
@
and,
.Such real world example: when name is
'martin@'
and email ismartin@email.com
, it creates this address for sending'martin@ <martin@email.com>'
, which fails.I added a filter for these characters:
@
,,
and;
in theget_address(name, email)
method.There could be more, these are the real life cases that I faced.
I also considered changing it in the 'cleaning' part of
subscription.save
so that these faulty names don't even go into the database, but I decided to let them in the database and just filter them out when sending. Feel free to put your opinions about this in this PR.