Passed
Push — master ( 715886...74726c )
by eval
06:41 queued 04:58
created

ses/client_xapi_send_email.go   A

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 16
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ses.*SES.XSendEmailHTML 0 2 1
A ses.*SES.xSendEmail 0 11 1
A ses.*SES.XSendEmailText 0 2 1
1
package ses
2
3
import (
4
	"context"
5
)
6
7
// XSendEmailText sends text type email.
8
func (svc *SES) XSendEmailText(ctx context.Context, subject, body, from string, to ...string) error {
9
	return svc.xSendEmail(ctx, subject, "", body, from, to...)
10
}
11
12
// XSendEmailHTML sends HTML type email.
13
func (svc *SES) XSendEmailHTML(ctx context.Context, subject, body, from string, to ...string) error {
14
	return svc.xSendEmail(ctx, subject, body, "", from, to...)
15
}
16
17
func (svc *SES) xSendEmail(ctx context.Context, subject, htmlBody, textBody, from string, to ...string) error {
18
	_, err := svc.SendEmail(ctx, SendEmailRequest{
19
		Destination: Destination{
20
			ToAddresses: to,
21
		},
22
		Source:   from,
23
		Subject:  subject,
24
		HTMLBody: htmlBody,
25
		TextBody: textBody,
26
	})
27
	return err
28
}
29