Spire.Email for .NET is a professional .NET Email library specially designed for developers to create, read and manipulate emails from any .NET (C#, VB.NET, ASP.NET) platform with fast and high quality performance.

Thu May 26, 2022 7:49 am

Hi,
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;

            }

davidzhang1976
 
Posts: 3
Joined: Wed May 25, 2022 6:45 am

Fri May 27, 2022 10:04 am

您好,

感谢您的咨询。

对于您提到的情况,我进行了初步的尝试,但并没有重现到这个问题。为了协助我们复现它,能否请您提供一个简单的示例项目(包含完整的测试代码)?您可以将文件上传到这里或者通过邮箱(support@e-iceblue.com)发送给我们。感谢您的协助。
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Sun May 29, 2022 11:16 am

Hi, Andy Zhou

我将我的完整代码发到 support@e-iceblue.com 这个邮箱了,期待你的回复,非常感谢!

davidzhang1976
 
Posts: 3
Joined: Wed May 25, 2022 6:45 am

Mon May 30, 2022 9:47 am

您好,

非常感谢您分享的测试项目。
根据您的提示,我们同样使用QQ邮箱进行了测试。结果确实如您提到的一样,附件名称携带中文时,提取的附件名会是乱码。我已将此问题提交给研发部门进行调查和修复,问题编号是SPIREEMAIL-61。有任何更新和进展我们会及时通知您。
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Tue May 31, 2022 5:21 am

Hi, Andy Zhou

好的,期待问题尽快得到解决。谢谢!

davidzhang1976
 
Posts: 3
Joined: Wed May 25, 2022 6:45 am

Return to Spire.Email