Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haf/mailgun
Mailgun F# wrapper (Not, not failgun :))
https://github.com/haf/mailgun
Last synced: about 1 month ago
JSON representation
Mailgun F# wrapper (Not, not failgun :))
- Host: GitHub
- URL: https://github.com/haf/mailgun
- Owner: haf
- Created: 2015-04-03T09:59:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-26T10:23:22.000Z (over 8 years ago)
- Last Synced: 2024-11-05T00:38:07.857Z (about 2 months ago)
- Language: F#
- Homepage:
- Size: 51.8 KB
- Stars: 3
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mailgun
A F# API for Mailgun.
Sponsored by
[qvitoo – A.I. bookkeeping](https://qvitoo.com/?utm_source=github&utm_campaign=repos).### Usage:
``` fsharp
open System.Net.Mail
open Mailgun.Api
open HttpClientlet env key =
match System.Environment.GetEnvironmentVariable key with
| null -> Tests.failtestf "provide env var %s for tests" key
| value -> valuelet conf = { apiKey = env "MAILGUN_API_KEY" }
let msg =
{ from = MailAddress "[email protected]"
``to`` = [ MailAddress "[email protected]" ]
cc = []
bcc = []
subject = "Hello World åäö"
body = TextBody "Hi!Would you like to go to the prom with me?
XOXOXOXOX
Yourself."
attachments = [] }
let settings = { SendOpts.Create "sandbox60931.mailgun.org" with testMode = true }
match Messages.send conf settings msg |> Hopac.Job.Global.run with
| Result (_, resp) ->
Assert.Equal("correct status code", 200, resp.StatusCode)
| other ->
Tests.failtestf "got %A, but expected valid result" other
```## Compiling
`bundle exec rake`
## Running Tests
`bundle exec rake tests`