Compare commits

...

2 Commits

Author SHA1 Message Date
bel
fbc173a78f casing 2026-02-24 00:01:33 -07:00
bel
8e40f85166 accept inbox 2026-02-24 00:00:46 -07:00
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.INT, "b", "dont read more than this many characters", 4096)
as.Append(args.BOOL, "json", "output as json", false) as.Append(args.BOOL, "json", "output as json", false)
as.Append(args.STRING, "oauth", "", emailer.OAuth) as.Append(args.STRING, "oauth", "", emailer.OAuth)
as.Append(args.STRING, "inbox", "", emailer.Inbox)
if err := as.Parse(); err != nil { if err := as.Parse(); err != nil {
panic(err) panic(err)
} }
@@ -35,6 +36,7 @@ func main() {
emailer.From = as.GetString("u") emailer.From = as.GetString("u")
emailer.Password = as.GetString("p") emailer.Password = as.GetString("p")
emailer.OAuth = as.GetString("oauth") emailer.OAuth = as.GetString("oauth")
emailer.Inbox = as.GetString("inbox")
var msgs <-chan *mail.Message var msgs <-chan *mail.Message
var err error var err error

View File

@@ -35,6 +35,7 @@ type Emailer struct {
Password string Password string
Limit int Limit int
OAuth string OAuth string
Inbox string
} }
func NewEmailer() *Emailer { func NewEmailer() *Emailer {
@@ -49,6 +50,7 @@ func NewEmailer() *Emailer {
SMTP: envOr("SMTP", "smtp.gmail.com:465"), SMTP: envOr("SMTP", "smtp.gmail.com:465"),
Password: envOr("PASSWORD", "lhnjijrvqaesiufp"), Password: envOr("PASSWORD", "lhnjijrvqaesiufp"),
OAuth: envOr("OAUTH", ""), 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 return nil, err
} }
} }
mbox, err := c.Select("INBOX", true) //readonly mbox, err := c.Select(e.Inbox, true) //readonly
if err != nil { if err != nil {
return nil, err return nil, err
} }