File: mail.go

package info (click to toggle)
golang-github-denverdino-aliyungo 0.0~git20180921.13fa8aa-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,824 kB
  • sloc: xml: 1,359; makefile: 3
file content (52 lines) | stat: -rwxr-xr-x 1,482 bytes parent folder | download | duplicates (3)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package dm

import (
	"net/http"

	"github.com/denverdino/aliyungo/common"
)

type SendEmailArgs struct {
	AccountName string
	AddressType string
}

type SendBatchMailArgs struct {
	SendEmailArgs
	TemplateName string
	ReceiverName string
	TagName      string
}

//remember to setup the accountName in your aliyun console
//addressType should be "1" or "0",
//0:random address, it's recommanded
//1:sender's address
//tagName is optional, you can use "" if you don't wanna use it
//please set the receiverName and template in the console of Aliyun before you call this API,if you use tagName, you should set it as well

func (this *Client) SendBatchMail(args *SendBatchMailArgs) error {
	return this.InvokeByAnyMethod(http.MethodPost, BatchSendMail, "", args, &common.Response{})
}

type SendSingleMailArgs struct {
	SendEmailArgs
	ReplyToAddress bool
	ToAddress      string
	FromAlias      string
	Subject        string
	HtmlBody       string
	TextBody       string
}

//remember to setup the accountName in your aliyun console
//addressType should be "1" or "0",
//0:random address, it's recommanded
//1:sender's address
//please set the receiverName and template in the console of Aliyun before you call this API,if you use tagName, you should set it as well

//fromAlias, subject, htmlBody, textBody are optional

func (this *Client) SendSingleMail(args *SendSingleMailArgs) error {
	return this.InvokeByAnyMethod(http.MethodPost, SingleSendMail, "", args, &common.Response{})
}