andlabs / ews

quick and dirty Go package to send emails via Exchange using EWS instead of SMTP
Other
27 stars 45 forks source link

very dumb, hacky, possibly flaky package to send emails from an Exchange server via EWS (in the event yours doesn't expose a SMTP server)

usage:

b, err := ews.BuildTextEmail(
    "me@server.com",
    []string{"friend@example.com", "someone@else.com"},
    "An email subject",
    []byte("The email body, as plain text"))
if err != nil {
    // handle err
}
resp, err := ews.Issue(
    "https://exhange.server.com/ews/Exchange.asmx",
    "domain\\username",
    "password",
    b)
if err != nil {
    // handle err
}
if resp.StatusCode != 200 {
    // read body and figure out what happened
}
// read or ignore body; the email was sent

the other exported types are just the raw data structures for the request XML; you can ignore them

I'm not sure if I'll develop this further; feel free to (warning: here be SOAP) some resources I used are in comments in the code

TODOs