|
|
@ -217,25 +217,26 @@ func GetMessage(server string, email string, password string,folder string,id ui
|
|
|
|
mailitem.Subject=s
|
|
|
|
mailitem.Subject=s
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Process each message's part
|
|
|
|
// Process each message's part
|
|
|
|
//for {
|
|
|
|
for {
|
|
|
|
// p, err := mr.NextPart()
|
|
|
|
p, err := mr.NextPart()
|
|
|
|
// if err == io.EOF {
|
|
|
|
if err == io.EOF {
|
|
|
|
// break
|
|
|
|
break
|
|
|
|
// } else if err != nil {
|
|
|
|
} else if err != nil {
|
|
|
|
//log.Fatal(err)
|
|
|
|
//log.Fatal(err)
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//
|
|
|
|
switch h := p.Header.(type) {
|
|
|
|
// switch h := p.Header.(type) {
|
|
|
|
case *mail.InlineHeader:
|
|
|
|
// case *mail.InlineHeader:
|
|
|
|
// This is the message's text (can be plain-text or HTML)
|
|
|
|
// // This is the message's text (can be plain-text or HTML)
|
|
|
|
b, _ := ioutil.ReadAll(p.Body)
|
|
|
|
// b, _ := ioutil.ReadAll(p.Body)
|
|
|
|
mailitem.Body+=string(b)
|
|
|
|
// log.Println("Got text: ", string(b))
|
|
|
|
//body,_:=dec.Decode(string(b))
|
|
|
|
// case *mail.AttachmentHeader:
|
|
|
|
log.Println("Got text: ", string(b))
|
|
|
|
// // This is an attachment
|
|
|
|
case *mail.AttachmentHeader:
|
|
|
|
// filename, _ := h.Filename()
|
|
|
|
// This is an attachment
|
|
|
|
// log.Println("Got attachment: ", filename)
|
|
|
|
filename, _ := h.Filename()
|
|
|
|
// }
|
|
|
|
log.Println("Got attachment: ", filename)
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return mailitem
|
|
|
|
return mailitem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func GetDecoder()*mime.WordDecoder{
|
|
|
|
func GetDecoder()*mime.WordDecoder{
|
|
|
|