master
Bel LaPointe 2022-01-09 22:56:37 -05:00
parent 7bfa368a24
commit ccadaa12d9
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@ type Emailer struct {
POP3 string POP3 string
IMAP string IMAP string
Password string Password string
Limit int
} }
func (e *Emailer) Read() (chan *mail.Message, error) { func (e *Emailer) Read() (chan *mail.Message, error) {
@ -39,6 +40,9 @@ func (e *Emailer) ReadIMAP() (chan *mail.Message, error) {
} }
from := uint32(1) from := uint32(1)
to := mbox.Messages to := mbox.Messages
if e.Limit > 0 && to > uint32(e.Limit) {
to = uint32(e.Limit)
}
seqset := new(imap.SeqSet) seqset := new(imap.SeqSet)
seqset.AddRange(from, to) seqset.AddRange(from, to)
emails := make(chan *mail.Message) emails := make(chan *mail.Message)