I'm using spire.email 5.5.0.0, use the imapclient to get the mailmessage, when I using the method 'getFullMessage', and the attachment.filename be displayed correctly even it's Chinese character, but it will take too long time when the attachment file is large. But when I change the method to 'getMessageText'(I just need the attachment filename, need not download it), the filename can not display Chinese charater correctly.How can I do? Thank you!
- Code: Select all
client.Select("Sent Messages");
ImapMessageCollection imapMessages = sm_imapFolder.Messages;
foreach (ImapMessage imapMessage in imapMessages)
{
int index = this.dataGridView1.Rows.Add();
this.dataGridView1.Rows[index].Cells[0].Value = imapMessage.Date.ToString();
this.dataGridView1.Rows[index].Cells[1].Value = imapMessage.From;
this.dataGridView1.Rows[index].Cells[2].Value = imapMessage.To;
this.dataGridView1.Rows[index].Cells[3].Value = imapMessage.Subject;
//string uid = imapMessage.UniqueId;
//MailMessage mailMessage = client.GetFullMessage(uid);
int sqnum = imapMessage.SequenceNumber;
MailMessage mailMessage = client.GetMessageText(sqnum);
this.dataGridView1.Rows[index].Cells[4].Value = mailMessage.BodyText;
string attachmentName = "";
foreach(Attachment attachment in mailMessage.Attachments)
{
attachmentName += attachment.FileName;
attachmentName += "\n";
}
this.dataGridView1.Rows[index].Cells[5].Value = attachmentName;
}