kaisellgren / mailer

Compose and send emails from Dart. Supports file attachments, HTML emails and multiple transport methods.
MIT License
168 stars 87 forks source link

Introduce validator on Address() #157

Open enricobenedos opened 3 years ago

enricobenedos commented 3 years ago

Good morning,

I spent some time to understand why some users was experiencing some problems with my app when sending mails. This was the error:

After sending MAIL FROM:<e@e.it>, response did not start with any of: [2].
Response from server: < 550 5.1.0 yIhdkhTPKKpB1yIhekj1KR invalid domain

After some research I found it was simply caused by a tab in the Address() name parameter.

Can it be an idea to create a validator that does not permit to introduce wrong space in the name string?

Thanks

close2 commented 3 years ago

mailer should definitely provide a possibility for address-validation.

Earlier versions had a validator which was RFC conform: https://github.com/kaisellgren/mailer/blob/cb1a63610057cdd8d04950af7e0ccb004c635aa7/lib/src/address.dart

I think that we must allow different validators. A lot of (RFC) valid addresses shouldn't be allowed.