This input works:
my_email_str = "Hans Peter Example <hans-peter@example.com>"
This input fails:
my_email_str = "Hans-Peter Example <hans-peter@example.com>"
with
pydantic.error_wrappers.ValidationError: 1 validation error for MessageSchema
recipients -> 0
value is not a valid email address (type=value_error.email)
Having a closer look at the fastapi-mail code, i see that it's actually not supposed to handle
pydantics NameEmail schema (e.g. Example Name \example@example.com\)
but
pydantics EmailStr schema (e.g. example@example.com).
So, I'm even a bit surprised that the first input actually works.
Depending how you look at it, this is now a bug report or a feature request :)
I try to send an email to people who have a dash in their name. (Happens for example sometimes with double names in German. e.g. Hans-Peter)
This input works:
my_email_str = "Hans Peter Example <hans-peter@example.com>"
This input fails:
my_email_str = "Hans-Peter Example <hans-peter@example.com>"
withHaving a closer look at the fastapi-mail code, i see that it's actually not supposed to handle
pydantics
NameEmail
schema (e.g. Example Name \example@example.com\) but pydanticsEmailStr
schema (e.g. example@example.com).So, I'm even a bit surprised that the first input actually works. Depending how you look at it, this is now a bug report or a feature request :)