-
Notifications
You must be signed in to change notification settings - Fork 46
/
README
32 lines (27 loc) · 943 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
- figure out why UTF-8 isn't used for email bodies, or how to force the encoding