impl recv.go

master v0.0.0
Bel LaPointe 2022-04-20 17:56:13 -06:00
parent f3105c9675
commit 096424ff3b
3 changed files with 30 additions and 2 deletions

View File

@ -33,7 +33,7 @@ func NewEmailer() *Emailer {
return &Emailer{
From: envOr("FROM", "breellocaldev@gmail.com"),
SMTP: envOr("SMTP", "smtp.gmail.com:465"),
Password: envOr("PASSWORD", "ML3WQRFSqe9rQ8qNkm"),
Password: envOr("PASSWORD", "lhnjijrvqaesiufp"),
}
}

28
recv.go Executable file
View File

@ -0,0 +1,28 @@
package main
import (
"local/args"
"local/sandbox/contact/contact"
"log"
)
func main() {
emailer := contact.NewEmailer()
as := args.NewArgSet()
as.Append(args.STRING, "imap", "imap server:port", "imap.gmail.com:993")
as.Append(args.INT, "n", "limit (<1 for inf)", 10)
if err := as.Parse(); err != nil {
panic(err)
}
emailer.IMAP = as.Get("imap").GetString()
emailer.Limit = as.Get("n").GetInt()
msgs, err := emailer.Read()
if err != nil {
panic(err)
}
for msg := range msgs {
log.Println(msg)
}
}

View File

@ -18,7 +18,7 @@ func main() {
if err := as.Parse(); err != nil {
panic(err)
}
emailer := &contact.Emailer{
emailer = &contact.Emailer{
From: as.Get("from").GetString(),
SMTP: as.Get("smtp").GetString(),
POP3: as.Get("pop3").GetString(),