accept username/password

master
Bel LaPointe 2023-10-16 08:18:44 -06:00
parent 2313cc3ac5
commit 48cb9bf32b
1 changed files with 4 additions and 0 deletions

View File

@ -16,12 +16,16 @@ func main() {
as := args.NewArgSet() as := args.NewArgSet()
as.Append(args.STRING, "imap", "imap server:port", "imap.gmail.com:993") as.Append(args.STRING, "imap", "imap server:port", "imap.gmail.com:993")
as.Append(args.INT, "n", "limit (<1 for inf)", 10) as.Append(args.INT, "n", "limit (<1 for inf)", 10)
as.Append(args.STRING, "u", "username", emailer.From)
as.Append(args.STRING, "p", "password", emailer.Password)
if err := as.Parse(); err != nil { if err := as.Parse(); err != nil {
panic(err) panic(err)
} }
emailer.IMAP = as.Get("imap").GetString() emailer.IMAP = as.Get("imap").GetString()
emailer.Limit = as.Get("n").GetInt() emailer.Limit = as.Get("n").GetInt()
emailer.From = as.GetString("u")
emailer.Password = as.GetString("p")
msgs, err := emailer.Read() msgs, err := emailer.Read()
if err != nil { if err != nil {