Skip to content

qwerty-iot/azure-comms-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

azure-comms-go

Build Status GoDoc License ReportCard

https://github.com/qwerty-iot/azure-comms-go

This package is a partial implementation of the Azure Communication Services API for Go. The current focus is on support for Email and SMS services.

Key Features

  • Supports sending email via Azure Communication Services
  • Supports authentication via Connection String

Samples

import "github.com/qwerty-iot/azure-comms"

func main() {
    // insert your connection string here
    connString := "endpoint=https://<endpoint>/;accesskey=<key>" 
	
    // NOTE: the sender address must be registered in the Azure portal
    es, _ := azurecomms.NewEmailSender(connString, "<senderAddress>", "John Doe", "[email protected]")

    m := es.NewMail()
    m.AddTo("[email protected]", "John Doe")
    m.SetSubject("test email from go")
    m.SetContent("<html><body>this is a test</body></html>", "this is a test email from go")
    err := m.Send()
    if err != nil {
        fmt.Println(err)
    }
}

License

Mozilla Public License Version 2.0