5 ms·
Elixir-mail – Build composable mail messages
- aczerepinski 11y agoI don't (currently) have a need for this so I'm not going to play with it right now, but I like that it looks idiomatically like Plug. Pass a struct through a pipeline until it's ready to go.
- arca_vorago 11y agoThis is exactly one of the things I have been hoping would get started in Elixir. I would really like more helpful documentation though. I'm imagining an entire ecosystem will begin to show up inside Elixir (and phoenix) as people realize how powerful it can be.
- marvel_boy 11y agoAbsolutley agree with the lack of documentation. As a newbie on Elixir and Phoenix I wish it will improve over time.
- aczerepinski 11y agoI've got to strongly disagree with you on this. This library is a day old and there are already descriptions and examples on every public function. This is an example of the Elixir community's EXCELLENT documentation.
- alexgaribay 11y agoThe project had its first commit yesterday. I wouldn't expect any sort of serious/reliable documentation until more of the project gets implemented.
- MCRed 11y agoThe code uses elixirs built in doc system so you should be able to build docs after cloning the repo. At a cursory glance it seems pretty reasonably well documented.
- markatkinson 11y agoYea it's ExDoc, think this should be helpful: http://elixir-lang.org/getting-started/mix-otp/docs-tests-and-with.html http://elixir-lang.org/getting-started/mix-otp/docs-tests-an... On mobile and on the run so can't confirm.
- bryanjos 11y agoThere is documentation at hexdocs: http://hexdocs.pm/mail/ http://hexdocs.pm/mail/
- cschneid 11y agoI 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.
- bcardarella 11y agoI'm the author. This library is still very early in development (two days of dev time). Its great that its on HN front page but I just want to manage expectations if you try to use the library. It is still very alpha.
- pmarreck 11y agoWhile I like the composability from a readability standpoint, is this creating unnecessary VM GC churn due to needing to maintain immutability of the %Mail{} struct? In other words, would it be better if you could just apply all attributes at once (with one function call, say "put", that took, say, a Map)? Or does that basically destroy this convention. lol
- aczerepinski 11y agoI doubt this is a performance issue, because it's the same pattern Phoenix uses to respond to an html request. Phoenix is very fast despite passing the much larger Plug.Conn struct through a much larger number of functions that similarly update one thing and return a new copy. I'd also be curious to know what happens with GC behind the scenes for this pattern to be so performant - I don't know anything about that part.
- im_down_w_otp 11y agoIt will be a performance issue at some point. It creates a lot of allocator & GC churn. Part of the reason this is mitigated somewhat has to do with how the Beam VM manages GC. It's per process, which provides a few nice features. One is that processes that do a lot of "work" tend not to be long-lived, and consequently they tend not to accrete a lot of heap allocations. The share-nothing concurrency model enforces an isolation pattern on the developer, which then allows the GC to make some guaranteed assumptions about what is safe and isn't safe to reap. The combination of those to factors allows GC sweeps to be both typically small/short and also done in parallel with other scheduled running processes, so that GC doesn't block all the execution resources. Considering the use case here though, I'd really not worry about it. The only way it'd likely bite you is if you were building a massive scale email pushing application, and you were weirdly trying to optimize for using as low-end, or as few, machines as possible to run it, and you hadn't already found yourself flagged by every mail relay as being a spammer.
- rgawdzik 11y agoFor anyone new to Elixir and is interested in it's performance, check out: https://github.com/mroth/phoenix-showdown https://github.com/mroth/phoenix-showdown tldr: It rivals Go in performance.
- TheHippo 11y agoFor Go it uses the slowest webframework that is available.
- cryptoxen 11y agoThey also tested the frameworks on a dual 10 core xeon where elixir/phoenix came out on top. https://gist.github.com/omnibs/e5e72b31e6bd25caf39a https://gist.github.com/omnibs/e5e72b31e6bd25caf39a
- TheHippo 11y agoAnd you used the Go 1.3.3 which came out Oct 2014, but the current dev version for Elixir. This seems not fair.
- no1youknowz 11y agoI'd like to see vs Go 1.6 released.
- jtwebman 11y agoThis is old, I willing to bet Elixir and Pheonix are better then Go now. It isn't all about performance though. I find Elixir easier to read and maintain over Go as well.
- kai_hn 11y agoRelated: A simple SMTP mailer in elixir: https://github.com/antp/mailer https://github.com/antp/mailer
- awetzel 11y agoAlso related: https://github.com/awetzel/mailibex https://github.com/awetzel/mailibex