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