
Hey all, I'm wondering what people do in general for sending email, especially from web apps. So far, I've written some basic modules in my apps that wrap around the sendmail executable on the system. Are there packages on Hackage that people would recommend? As long as I'm bringing this up, I think I nice email system would offer built in support for creating multipart messages. Bonus points would be to automatically create a text/plain version from an HTML version. If no one knows of prior art on this, I might try to implement it as a module in Yesod. Michael

I know it probably sounds terrible, but we've gotten away with using
runInteractiveProcess + sendmail for all of our email. So far it has
worked pretty well.
That said, if you end up writing such a thing, we would be interested
in testing it.
On Thu, Aug 19, 2010 at 11:43 AM, Michael Snoyman
Hey all, I'm wondering what people do in general for sending email, especially from web apps. So far, I've written some basic modules in my apps that wrap around the sendmail executable on the system. Are there packages on Hackage that people would recommend? As long as I'm bringing this up, I think I nice email system would offer built in support for creating multipart messages. Bonus points would be to automatically create a text/plain version from an HTML version. If no one knows of prior art on this, I might try to implement it as a module in Yesod. Michael _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

I've written a module in Yesod for email[1], but it doesn't actually rely on
any Yesod features, so could be factored out easily. I've also written a
sample program[2] to go along with it. The main feature is to be able to
easily generate multi-part emails. It also includes some code to send an
email via createProcess/sendmail.
If people like this and would like to see it released outside of Yesod, I
can easily do so.
Jeremy:
It seems strange that SMTPClient uses a String to represent the message
body. My module uses a lazy ByteString. I suppose you could always just do a
Lazy.Char8.unpack to get the results from my module into SMTPClient.
I like the idea of using markdown, I might try that in the future. As far as
the templating, I'm not even touching that one: Yesod.Mail deals exlusively
with lazy ByteStrings, and you can generate those however you see fit.
Michael
[1] http://github.com/snoyberg/yesod/blob/master/Yesod/Mail.hs
http://github.com/snoyberg/yesod/blob/master/Yesod/Mail.hs[2]
http://github.com/snoyberg/yesod/blob/master/mail.hs
On Fri, Aug 20, 2010 at 1:33 AM, Clint Moore
I know it probably sounds terrible, but we've gotten away with using runInteractiveProcess + sendmail for all of our email. So far it has worked pretty well.
That said, if you end up writing such a thing, we would be interested in testing it.
On Thu, Aug 19, 2010 at 11:43 AM, Michael Snoyman
wrote: Hey all, I'm wondering what people do in general for sending email, especially from web apps. So far, I've written some basic modules in my apps that wrap around the sendmail executable on the system. Are there packages on Hackage that people would recommend? As long as I'm bringing this up, I think I nice email system would offer built in support for creating multipart messages. Bonus points would be to automatically create a text/plain version from an HTML version. If no one knows of prior art on this, I might try to implement it as a module in Yesod. Michael _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

Hello, There are several pieces I have experience with. One option is the SMTPClient package: http://hackage.haskell.org/package/SMTPClient-1.0.3 It now includes a simple wrapper for sending mail via a smarthost, http://hackage.haskell.org/packages/archive/SMTPClient/1.0.3/doc/html/Networ... At one point in time I worked on a MIME library for parsing and composing MIME messages. It tries to use the type system to enforce some level of correctness. It has types for representing MIME messages, and parsing attachments. But he composition module does not yet encode attachments: http://src.seereason.com/haskell-mime/ The compose module includes a wrapper function to call sendmail. http://src.seereason.com/haskell-mime/Text/MIME/Compose.hs Instead of converting text/html to text/plain, perhaps you want to the input to be markdown, which can be converted to text/html or text/ plain ? There is also the issue of templating. I think the requirements of email templates are different from HTML templates. I am fine with having my HTML templates be type-checked and compiled into the application. But, for many uses of email, that does not make sense. If I want to send an email to my list every day (or week) I am not going to want to recompile the app everytime. I am going to want the email to come from a file on the disk or a textarea or something. That also seems to mean that the information which can be inserted into the template is rather static. There is going to be a list of available fields, such as first name, last name, etc.. Unlike html templates, runtime checking of the template is not really a big issue. I am going to type up my message, and then hit 'preview' and see what it looks like and see an templating errors. So, in summary, here are the features I would like: - runtime templates - support for smarthosts and local sendmail - the ability to create the message via markdown and convert it to text/plain and/or text/html - the ability to create MIME attachments Also I would like to have opt-in/opt-out features. Similar to how mailman and other listserv things work. You can sign up for a list via a form or via email, and then you get a confirmation email with a link in it. Each messages sent can then include an unsubscribe link. Obviously, the opt-in/opt-out stuff is not required for all uses. And it is really a library that builds on top of the core email functionality -- it does not need to be included by default. Especially since that starts incorporating html/http/web framework/ database stuff, and people are going to want something that works with their particular system. And now that I think of it, the template solution should probably be a separate layer as well. - jeremy p.s. I will look at the patches to web-routes soon, I swear! On Aug 19, 2010, at 1:43 PM, Michael Snoyman wrote:
Hey all,
I'm wondering what people do in general for sending email, especially from web apps. So far, I've written some basic modules in my apps that wrap around the sendmail executable on the system. Are there packages on Hackage that people would recommend?
As long as I'm bringing this up, I think I nice email system would offer built in support for creating multipart messages. Bonus points would be to automatically create a text/plain version from an HTML version. If no one knows of prior art on this, I might try to implement it as a module in Yesod.
Michael _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
participants (3)
-
Clint Moore
-
Jeremy Shaw
-
Michael Snoyman