be less pessimistic about errors
This commit is contained in:
parent
fb3a698210
commit
ddd2bacbae
|
@ -149,17 +149,15 @@ func Fetch(p *Parameters) ([]*mail.Message, []error) {
|
||||||
func FetchPlaintext(p *Parameters) ([]string, []error) {
|
func FetchPlaintext(p *Parameters) ([]string, []error) {
|
||||||
mails, errs := Fetch(p)
|
mails, errs := Fetch(p)
|
||||||
mailsPlain := make([]string, 0)
|
mailsPlain := make([]string, 0)
|
||||||
if len(errs) == 0 {
|
for _, mail := range mails {
|
||||||
for _, mail := range mails {
|
// check for mime parts
|
||||||
// check for mime parts
|
parts, pErrs := getPlainParts(mail)
|
||||||
parts, pErrs := getPlainParts(mail)
|
errs = append(errs, pErrs...)
|
||||||
errs = append(errs, pErrs...)
|
date := mail.Header.Get("Date")
|
||||||
date := mail.Header.Get("Date")
|
from := mail.Header.Get("From")
|
||||||
from := mail.Header.Get("From")
|
subject := mail.Header.Get("Subject")
|
||||||
subject := mail.Header.Get("Subject")
|
m := fmt.Sprintf("Date: %s\nFrom: %s\nSubject: %s\n\n%s", date, from, subject, strings.Join(parts, "\n\n"))
|
||||||
m := fmt.Sprintf("Date: %s\nFrom: %s\nSubject: %s\n\n%s", date, from, subject, strings.Join(parts, "\n\n"))
|
mailsPlain = append(mailsPlain, m)
|
||||||
mailsPlain = append(mailsPlain, m)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return mailsPlain, errs
|
return mailsPlain, errs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user