Last active
December 22, 2018 09:32
-
-
Save whitetigle/7fec7fdbd07b79a5321a6975d125b515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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