-
Notifications
You must be signed in to change notification settings - Fork 374
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.
To send a simple email in a handler:
import qualified Network.Mail.Mime as Mail
liftIO $ Mail.renderSendMail $ Mail.simpleMail'
(Mail.Address Nothing "[email protected]") -- To address, Nothing can be replaced with a name
(Mail.Address (Just "King of My Site") "[email protected]") -- 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.