Skip to content

Sending email

Murray edited this page Jan 15, 2016 · 2 revisions

For now, this is just a filler page. We'll be including information on how to add email sending capability to a Yesod app, what options you have for sending on the server, and how to set up a simple development option.

Quick guide

To send a simple email in a handler:

import qualified Network.Mail.Mime as Mail

liftIO $ Mail.renderSendMail $ Mail.simpleMail'
    (Mail.Address Nothing "dave.derp@gmail.com") -- To address, Nothing can be replaced with a name
    (Mail.Address (Just "King of My Site") "from.address@mysite.com") -- From address
    "Deus Vult" -- Subject
    "Nobiscum Deus" -- Body of the email

renderSendMail will use the sendmail available on your machine. In order to send emails from an external host(for example gmail) you can install msmtp. Make sure sendmail points to the msmtp executable and is configured to use your email account.

Clone this wiki locally
You can’t perform that action at this time.