2014-08-25 00:40:54 +02:00
|
|
|
package mailgun
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/pearkes/mailgun"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Config struct {
|
2014-11-18 15:21:32 +01:00
|
|
|
APIKey string
|
2014-08-25 00:40:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Client() returns a new client for accessing mailgun.
|
|
|
|
//
|
|
|
|
func (c *Config) Client() (*mailgun.Client, error) {
|
|
|
|
|
|
|
|
// We don't set a domain right away
|
|
|
|
client, err := mailgun.NewClient(c.APIKey)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Printf("[INFO] Mailgun Client configured ")
|
|
|
|
|
|
|
|
return client, nil
|
|
|
|
}
|