31 lines
638 B
Go
Executable File
31 lines
638 B
Go
Executable File
package contact
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestEmailer(t *testing.T) {
|
|
e := &Emailer{
|
|
From: "breellocaldev@gmail.com",
|
|
SMTP: "smtp.gmail.com:587",
|
|
POP3: "pop.gmail.com:995",
|
|
IMAP: "imap.gmail.com:993",
|
|
Password: "lhnjijrvqaesiufp",
|
|
}
|
|
|
|
emails, err := e.Read()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for email := range emails {
|
|
if strings.Contains(email.Header["From"][0], "Chase") {
|
|
b, _ := json.MarshalIndent(email.Header, "", " ")
|
|
t.Logf("%+v, %s", email, b)
|
|
}
|
|
}
|
|
//func (e *Emailer) Send(to, subj, msg string) error {
|
|
//func (e *Emailer) Read() ([]Email, error) {
|
|
}
|