accept inbox

This commit is contained in:
bel
2026-02-24 00:00:46 -07:00
parent 1b74eb0d16
commit 8e40f85166
2 changed files with 5 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ func main() {
as.Append(args.INT, "b", "dont read more than this many characters", 4096)
as.Append(args.BOOL, "json", "output as json", false)
as.Append(args.STRING, "oauth", "", emailer.OAuth)
as.Append(args.STRING, "inbox", "", emailer.Inbox)
if err := as.Parse(); err != nil {
panic(err)
}
@@ -35,6 +36,7 @@ func main() {
emailer.From = as.GetString("u")
emailer.Password = as.GetString("p")
emailer.OAuth = as.GetString("oauth")
emailer.Inbox = as.GetString("inbox")
var msgs <-chan *mail.Message
var err error

View File

@@ -35,6 +35,7 @@ type Emailer struct {
Password string
Limit int
OAuth string
Inbox string
}
func NewEmailer() *Emailer {
@@ -49,6 +50,7 @@ func NewEmailer() *Emailer {
SMTP: envOr("SMTP", "smtp.gmail.com:465"),
Password: envOr("PASSWORD", "lhnjijrvqaesiufp"),
OAuth: envOr("OAUTH", ""),
Inbox: envOr("INBOX", "INBOX"),
}
}
@@ -166,7 +168,7 @@ func (e *Emailer) readIMAP(authU, authP string) (chan *mail.Message, error) {
return nil, err
}
}
mbox, err := c.Select("INBOX", true) //readonly
mbox, err := c.Select(e.INBOX, true) //readonly
if err != nil {
return nil, err
}