Exchange Web Service client for golang
package main
import (
"fmt"
"github.com/mhewedy/ews"
"github.com/mhewedy/ews/ewsutil"
"log"
)
func main() {
c := ews.NewClient(
"https://outlook.office365.com/EWS/Exchange.asmx",
"email@exchangedomain",
"password",
&ews.Config{Dump: true, NTLM: false},
)
err := ewsutil.SendEmail(c,
[]string{"[email protected]", "[email protected]"},
"An email subject",
"The email body, as plain text",
)
if err != nil {
log.Fatal("err>: ", err.Error())
}
fmt.Println("--- success ---")
}Note: if you are using an on-premises Exchange server (or even if you manage your servers at the cloud), you need to pass the username as
AD_DOMAINNAME\usernameinstead, for examleMYCOMANY\mhewedy.
| Category | Operation | Supported* |
|---|---|---|
| eDiscovery operations | ||
| Exchange mailbox data operations | ||
| CreateItem operation | ✔️ (Email & Calendar) | |
| GetUserPhoto | ✔️ | |
| Availability operations | ||
| GetUserAvailability | ✔️ | |
| GetRoomLists | ✔️ | |
| Bulk transfer operations | ||
| Delegate management operations | ||
| Inbox rules operations | ||
| Mail app management operations | ||
| Mail tips operation | ||
| Message tracking operations | ||
| Notification operations | ||
| Persona operations | ||
| FindPeople | ✔️ | |
| GetPersona | ✔️ | |
| Retention policy operation | ||
| Service configuration operation | ||
| Sharing operations | ||
| Synchronization operations | ||
| Time zone operation | ||
| Unified Messaging operations | ||
| Unified Contact Store operations | ||
| User configuration operations |
- Not always 100% of fields are mapped.
Besides the operations supported above, few new operations under the namespace ewsutil has been introduced:
ewsutil.SendEmailewsutil.CreateEventewsutil.ListUsersEventsewsutil.FindPeopleewsutil.GetUserPhotoewsutil.GetUserPhotoBase64ewsutil.GetUserPhotoURLewsutil.GetPersona
NTLM is supported as well as Basic authentication