修复发件人和收件人编码问题

pull/30/head
陶士涵 5 years ago
parent 413cbc07ce
commit 812c759788

@ -192,10 +192,13 @@ func GetMessage(server string, email string, password string,folder string,id ui
mailitem.Date=date.String() mailitem.Date=date.String()
} }
var f string var f string
dec:=GetDecoder()
if from, err := header.AddressList("From"); err == nil { if from, err := header.AddressList("From"); err == nil {
log.Println("From:", from) log.Println("From:", from)
for _,address:=range from{ for _,address:=range from{
f+=" "+address.String() temp,_:=dec.DecodeHeader(address.String())
f+=" "+temp
} }
} }
mailitem.From=f mailitem.From=f
@ -203,11 +206,11 @@ func GetMessage(server string, email string, password string,folder string,id ui
if to, err := header.AddressList("To"); err == nil { if to, err := header.AddressList("To"); err == nil {
log.Println("To:", to) log.Println("To:", to)
for _,address:=range to{ for _,address:=range to{
t+=" "+address.String() temp,_:=dec.DecodeHeader(address.String())
t+=" "+temp
} }
} }
mailitem.To=t mailitem.To=t
dec:=GetDecoder()
if subject, err := header.Subject(); err == nil { if subject, err := header.Subject(); err == nil {
s,err:=dec.Decode(subject) s,err:=dec.Decode(subject)
if err!=nil{ if err!=nil{

Loading…
Cancel
Save