-
Notifications
You must be signed in to change notification settings - Fork 1
/
Std.go
43 lines (36 loc) · 916 Bytes
/
Std.go
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
package main
import (
"context"
"log"
"time"
"github.com/crossphoton/email-microservice/examples/src"
)
func sendEmailStd(req *src.SendEmailRequest) (*src.ResponseMessage, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
res, err := client.SendEmail(ctx, req)
if err != nil {
log.Printf("request failed: %v", err)
return nil, err
}
return res, nil
}
func StdEmail() (*src.ResponseMessage, error) {
emailRequest := src.SendEmailRequest{
Recipients: &src.Recipients{
To: []string{
"Aditya Agrawal<[email protected]>",
},
Cc: []string{
"Spam Address<[email protected]>",
},
Bcc: []string{
},
},
Subject: "Hi there. I hope you're good",
ContentType: "text/html",
Body: "<h1>This is heading</h1><p>This is text</p>",
}
return sendEmailStd(&emailRequest)
}