xhit / go-simple-mail

Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.
MIT License
650 stars 102 forks source link

Add a toggle to skip email validation #97

Closed meain closed 10 months ago

meain commented 10 months ago

This PR adds an option UseProvidedAddress which when set directly uses the email provided by the user without validating or trying to parse out its components.

Closes https://github.com/xhit/go-simple-mail/issues/95

meain commented 10 months ago

@xhit Quick question. I saw that you were using address.Address at certain places and address.String() at other. Is there a reason why we are doing it differently at different places.

If we use address.String() at all the paces, I think https://github.com/xhit/go-simple-mail/issues/11 also gets handled.

xhit commented 10 months ago

@meain address.Address contains only the email, with this we add to recipients to send a SMTP RCPT command because we only need the address here. The address.String() is the full address, with the name if provided, and the address enclosed by < and >, used to create a RFC822 formatted message to use un SMTP DATA command, also, dev can get it using GetMessage method.

Not all addresses in the message are populated by default, the BCC for example, are added to recipients for the RCPT command, but not in the message for the DATA command for security, with this, the recipients will not know the BCC addresses.

meain commented 10 months ago

address.Address contains only the email, with this we add to recipients to send a SMTP RCPT command because we only need the address here.

Hmm, I see. Would you be open to changing it to accepting the full address. Would it cause issues?

xhit commented 10 months ago

Hmm, I see. Would you be open to changing it to accepting the full address. Would it cause issues?

I can't, RCPT only receives the address, not full address.

codecov-commenter commented 10 months ago

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (3a06b6e) 52.51% compared to head (c70ebcd) 52.65%.

Files Patch % Lines
email.go 60.00% 7 Missing and 1 partial :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #97 +/- ## ========================================== + Coverage 52.51% 52.65% +0.14% ========================================== Files 7 7 Lines 1293 1297 +4 ========================================== + Hits 679 683 +4 Misses 545 545 Partials 69 69 ``` | [Flag](https://app.codecov.io/gh/xhit/go-simple-mail/pull/97/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Santiago+De+la+Cruz) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/xhit/go-simple-mail/pull/97/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Santiago+De+la+Cruz) | `52.65% <60.00%> (+0.14%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Santiago+De+la+Cruz#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

meain commented 10 months ago

@xhit Following our discussion, I've added a note in the readme and rebased the code on latest master. Let me know if you need anything else from the PR.

xhit commented 10 months ago

@meain sorry, I'm currently on vacations, I will tag a new version after that, you can use master branch. Thanks!

meain commented 10 months ago

Thanks @xhit. No rush on the tag :D