BoostryJP / ibet-Wallet-API

A powerful API suite for seamlessly building ibet blockchain wallet systems 🛠
https://ibet.jp/ibet-for-fin
Apache License 2.0
9 stars 0 forks source link

[BUG] Fail to send emails to email addresses longer than 80 characters #1488

Closed purplesmoke05 closed 8 months ago

purplesmoke05 commented 8 months ago

Describe the bug

https://github.com/BoostryJP/ibet-Wallet-API/blob/4d98ef19541ae04d3bcf2ee38889a806a541d09c/app/model/schema/messaging.py#L65-L66

from pydantic.networks import validate_email
test_email_address = "a"*80+"@example.com"
len(test_email_address)
> 92
validate_email(test_email_address)
Traceback (most recent call last):
  File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/pydantic/networks.py", line 696, in validate_email
    parts = email_validator.validate_email(email, check_deliverability=False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/email_validator/validate_email.py", line 71, in validate_email
    local_part_info = validate_email_local_part(local_part,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/email_validator/syntax.py", line 93, in validate_email_local_part
    raise EmailSyntaxError(f"The email address is too long before the @-sign {reason}.")
email_validator.exceptions_types.EmailSyntaxError: The email address is too long before the @-sign (16 characters too many).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/y-otosu/.anyenv/envs/pyenv/versions/ibet-Wallet-API/lib/python3.11/site-packages/pydantic/networks.py", line 698, in validate_email
    raise PydanticCustomError(
pydantic_core._pydantic_core.PydanticCustomError: value is not a valid email address: The email address is too long before the @-sign (16 characters too many).

Expected behavior