-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemailer_test.go
More file actions
67 lines (59 loc) · 1.26 KB
/
emailer_test.go
File metadata and controls
67 lines (59 loc) · 1.26 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package emailer
import (
"bytes"
"fmt"
"testing"
)
func TestEmailer(t *testing.T) {
var client *Client
client, err := NewClient(Options{
Host: "smtp-test.kause.in",
Port: "1025",
User: "user",
Pass: "pass",
Name: "Mailhog 1",
From: "mailhog1@mailhog.com",
})
if err != nil {
t.Error(err)
}
// send multiple emails from same client
for i := 0; i < 100; i++ {
var buf bytes.Buffer
buf.WriteString(fmt.Sprint("Test Email Content ", i+1))
mail := Mail{
To: []string{"vinit@crowdpouch.com", "vinit@kreateworld.in"},
Cc: []string{"test@email.com", "test-01@email.com"},
Bcc: []string{"some@email.com"},
Subject: fmt.Sprint("Test Email Subject ", i+1),
Body: buf,
}
mail.SendWith(client)
// time.Sleep(time.Second * 1)
}
}
/*
func TestEmailerMT(t *testing.T) {
var client *Client
client, err := NewClient(
Options{
Host: "smtp.mailtrap.io",
Port: "587",
User: "5b3e8dc2b0b914",
Pass: "0a67a6dd68737a",
Name: "Mailtrap 1",
From: "mailtrap1@mailtrap.io",
})
if err != nil {
t.Error(err)
}
var buf bytes.Buffer
buf.WriteString("Mailtrap content 1")
mail := Mail{
To: []string{"vinit@crowdpouch.com"},
Subject: "Mailtrap subject 1",
Body: buf,
}
mail.SendWith(client)
}
*/