Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #r "~/packages/Sendgrid.5.1.0/lib/SendGridMail.dll"
- #r "~/packages/SendGrid.SmtpApi.1.2.1/lib/net40/SendGrid.SmtpApi.dll"
- open System
- open System.Collections.Generic
- open System.Net
- open System.Net.Mail
- open SendGrid
- let message = new SendGridMessage()
- message.From <- new MailAddress("snadella@microsoft.com")
- let recipients = new List<string>()
- recipients.Add("bgates@microsoft.com")
- message.AddTo(recipients)
- message.Subject <- "Testing the SendGrid Library"
- message.Html <- "<p>Hello World!</p>"
- message.Text <- "Hello world plain text!"
- let username = "yourNameHere";
- let pswd = "yourPasswordHere";
- let credentials = new NetworkCredential(username, pswd);
- let transportWeb = new Web(credentials);
- try
- let mailResult = transportWeb.Deliver(message);
- ()
- with
- | :? Exceptions.InvalidApiRequestException as ex -> ex.Errors |> Seq.iter( fun e -> printfn "Exception! %s " e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement