Free Support Forum - aspose.com

Problem retriewing AttachementCollection

Hi,

I’m just begining programming with Apose.Network in C#. Thank you for your product it simplify my work.

I’m tring to retrive e-mail attachment. The connection to the pop3 server working fine but the AttachementCollection.Count retrun 0 and all e-mail have attachement.

info = client.GetMailboxInfo();
Console.WriteLine(info.MessageCount);
messageCount = info.MessageCount;
for (i = 1; i <= messageCount; i++)
{
msg = client.FetchMessage(i);
if (autorized(msg.From.ToString()))
{
Console.WriteLine("From : " + msg.From.ToString());
Console.WriteLine(msg.Attachments.Count);
manageAttach(msg.Attachments);

}
//supprime les messages lu
//client.DeleteMessage(i);
}

Thanks for help.

Hi, akunzler,

Our Developer is looking into the problem. We will get back to you as soon as possible.

Thanks

Hello,

Thank you for your post!
I was wondering if you could use client.SaveMessage method to save some of the messages and send it to guangzhou@aspose.com, it would be greatly appreciated.

Best regards.

Thank you for the reply.

I have sent *.eml.

Thanks for help

Hello akunzler,

Thank you for your post!
I've tested Pop3Client.FetchMessage(MessageId) and MailMessage.Attachments.Count, but i am unable to re-produce the problem. I'm guessing my pop3 server's settings is different from yours. I will investigate this further and keep you posted.

Just as a reminder, evaluation version of Aspose.Network will automatically add a license.txt as an attachment to the mail message generated or fetched.

Best regards!



Hello akunzler,

Please could you tell me if you can share your Pop3 user/password for my debugging? We cannot reproduce the problem as you mentioned.

I think if you can give me the account I can locate the root of the problem and fix it as soon as possible.

Send the user/password to my email guangzhou#aspose.com.

Feel free to ping me if you have any concerns.

Thanks.

Hello akunzler,

I want to share one more thing about fetching the E-Mail messages from Pop3 server. The latest message comes with the largest message index. For example, if there are 10 E-Mail messages in your mail box. The 10th message is the latest one, while the 1st message is the oldest one.

In other words, the FetchMessage(10) will get the latest message, and the FetchMessage(1) will be the oldest.

So could you please check it out in your Pop3 server to make sure you really get the right message as you think.

Thanks again.

Hi,

I’have tried with an other pop acount and the problem was the same. I fix it with downloading e-mails and work on it in local, so that work.

I had a deadline to do my work and with this solution it’s working. I can share my e-mail test acount if you want to solve the problem on amount.

I send the connexion seting per e-mail.

Thanks for help.

Adrian Kunzler

Dear Künzler,

I am writing this email to follow up the bug you mentioned in last post. Thanks for your kindness to provide the Pop3 server for my debugging.

I cannot reproduce the bug you mentioned. On my laptop, I can use the code to read the E-Mail from the Pop3 server, and extract the attachments from the E-Mail directly. The project attached is my debug demo; you can check it out if you have interesting.

However, it is good to keep your code, if everything goes fine. I think it is possible that this bug is relative to some mistakes from Pop3 server or network transferring.

Here is one more suggestion for your solution:

Please use the Pop3Client.SaveMessage to retrieve the E-Mail from the Pop3 server, instead of using Pop3Client.FetchMessage(int) and MailMessage.Save. The Pop3Client.SaveMessage will provide better performance without doing message format parsing.

Client.SaveMessage( 1, @”c:\message.eml”); //save the eml file directly to local file system

MailMessage message = MailMessage.Load(@”c:\message.eml”, Aspose.Network.Mail.MessageFormat.Eml); //parse the eml file into MailMessage instance

Finally, please change the password for the debugging pop3 account for security concern.

Thanks again and feel free to ping me with any problems.