alidmslim

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2022 License: MIT Imports: 15 Imported by: 0

README

alidmslim

Usage:

import "github.com/caiguanhao/alidmslim"

client := alidmslim.NewClient("noreply@yourdomain.com", ACCESS_KEY_ID, ACCESS_KEY_SECRET)

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

client.NewMail(subject, content).Send(ctx, "a@a.com", "b@b.com", ...)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(accountName, id, secret string) *Client

NewClient creates a client given access key ID and secret.

func (*Client) Debug

func (client *Client) Debug(debug bool) *Client

Creates a new client with debug (more information printed to stderr).

func (*Client) NewHTMLMail

func (client *Client) NewHTMLMail(subject, content string) *Mail

NewHTMLMail creates a new mail given subject and html content.

func (*Client) NewMail

func (client *Client) NewMail(subject, content string) *Mail

NewMail creates a new mail given subject and text content.

type Mail

type Mail struct {
	// contains filtered or unexported fields
}

func (Mail) MustSend

func (mail Mail) MustSend(ctx context.Context, addresses ...string)

MustSend sends a mail to target addresses, panics if send operation fails.

func (Mail) Send

func (mail Mail) Send(ctx context.Context, addresses ...string) error

Send sends a mail to target addresses.

type ResponseError

type ResponseError struct {
	Message string
	Code    string
}

func (ResponseError) Error

func (e ResponseError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL