3 ms·
I like this builder pattern. Seems pretty similar to https://hackage.haskell.org/package/optparse-applicative https://hackage.haskell.org/package/optparse-appli
by cschneid 11y ago
I like this builder pattern. Seems pretty similar to https://hackage.haskell.org/package/optparse-applicative https://hackage.haskell.org/package/optparse-applicative as well, where you continually apply small functions to a data structure to end up with a big one.
Since Elixir doesn't have mandatory types, I assume there's no way to verify at compile time that it's a "valid" email (Has a recipient, and a from addr, whatever other requirements), and you'd have to check that in tests or at runtime?
- im_down_w_otp 11y agoUse dialyzer.
- tyingq 11y agoAlso very similar to Perl's Mail::Send: http://search.cpan.org/~markov/MailTools-2.14/lib/Mail/Send.pod http://search.cpan.org/~markov/MailTools-2.14/lib/Mail/Send....
- pmarreck 11y agoUnfortunately, email format validation (similar to HTML email) is somewhat of a black art: http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx/ http://haacked.com/archive/2007/08/21/i-knew-how-to-validate... http://girders.org/blog/2013/01/31/dont-rfc-validate-email-addresses/ http://girders.org/blog/2013/01/31/dont-rfc-validate-email-a... Of course one could always just go with RFC822 and this little regex: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
- garethadams 11y agoThe parent wasn't talking about the individual validation of email addresses (although I guess that may be a part of the answer), but instead about checking the presence of a recipient, subject, sender etc as part of static typing.