Skip to content

Instantly share code, notes, and snippets.

@whitetigle
Last active December 22, 2018 09:32
Show Gist options
  • Save whitetigle/7fec7fdbd07b79a5321a6975d125b515 to your computer and use it in GitHub Desktop.
Save whitetigle/7fec7fdbd07b79a5321a6975d125b515 to your computer and use it in GitHub Desktop.
let config = jsOptions<Nodemail.Config>(fun opt ->
opt.auth <- {user=someUser;pass=password}
opt.port <- 465
opt.host <- host
opt.secure <- true
opt.debug <- true
)
let message= jsOptions<Nodemail.Message>( fun msg ->
msg.subject <- title
msg.text <- text
msg.``to`` <- recipient
msg.from <- from
msg.cc <- Some cc
)
let transport = Nodemail.nodemail.createTransport config
promise {
let! response = transport.sendMail message
return
if isNull response?messageId then
Error (unbox response)
else
let infos : Nodemail.Info = unbox response
Ok infos
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment