FetchMessage Aspose.Email.AsposeArgumentException "Wrong unique identifier"

Hi,

I am getting "Aspose.Email.AsposeArgumentException" with error mesage "Wrong unique identifier" while trying to fetch message with its UniqueId. In the code below, call to Pop3Client.FetchMessage method raises the error.


using Aspose.Email;
using Aspose.Email.Mail;
using Aspose.Email.Pop3;
using System;
using System.Linq;

namespace pop
{
class Program
{
static Pop3Client pop = new Pop3Client("pop.gmail.com", 995, "user@gmail.com", "password", SecurityOptions.Auto);
static void Main(string[] args)
{
string id = pop.ListMessages(true).First().UniqueId;
Console.WriteLine(id);
MailMessage msg = pop.FetchMessage(id);
Console.Write(msg);
Console.ReadKey();
}
}
}


Best regards

Hi Huseyin,

Thank you for writing to Aspose Support team.

We are unable to observe the exception using our own test accounts. Can you please share your sample message or a test account to reproduce the issue at our end. We’ll analyze the issue further to assist you accordingly.

Hi Huseyin,

Thank you for sharing the test account.

We have tried connecting to POP3 using SecurityOptions.SSLImplicit and fetching the message using the code shared earlier by you, but the error still did not came up. Please see attached project for your reference. Please try setting your test account in the attached project and see if you are still able to observe the same issue.

If the issue persists, please share your complete sample project for analyzing the issue further. We’ll look into it assist you accordingly.

Hi Maria,

Thank you for sharing the sample project.

I have tried the sample code after replacing the credentials, but the error persists. We believe that the cause of the problem is the culture settings of the environment. The culture of the system in which we test the code is Turkish culture (“tr-TR”), and this is the case for many of our clients.

When we try and set the CultureInfo.DefaultThreadCurrentCulture to CultureInfo.InvariantCulture the issue seems to be solved. However, we have this problem in a large application which has child threads that rely on the starting culture of the application. Therefore, we can not change the default thread culture.

I am attaching the sample project (a slightly tweaked version of the originally shared code) in order to demonstrate the problem. The project is in .NET 4.5. The main code is as follows:

using Aspose.Email;

using Aspose.Email.Pop3;

using System;

using System.Configuration;

using System.Globalization;

using System.Linq;

namespace pop

{

class Program

{

static Pop3Client pop = new Pop3Client(“[pop.gmail.com](http://pop.gmail.com/)”, 995, SecurityOptions.SSLImplicit)

{

Username = ConfigurationManager.AppSettings[“usr”],

Password = ConfigurationManager.AppSettings[“psw”]

};

static void Main(string[] args)

{

// no error when invariant culture is set.

CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;

// When Turkish culture is set, FetchMessage throws an exception.

[//CultureInfo.DefaultThreadCurrentCulture](https://cultureinfo.defaultthreadcurrentculture/) = new CultureInfo(“tr-TR”);

string id = pop.ListMessages(false).First().UniqueId;

Console.WriteLine(id);

var msg = pop.FetchMessage(id); // throws Aspose.Email.AsposeArgumentException when current culture is “tr-TR”

Console.WriteLine(msg);

Console.WriteLine(“Fetch successful”);

Console.ReadKey();

}

}

}

The above code executes without an error. However, if the line
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(“tr-TR”);

is uncommented, FetchMessage method throws an exception. We believe you will be able to observe the same behavior in your test environment.

Thanks & Best Regards

Hi Huseyin,

Thank you for the additional details.

We were able to reproduce the same issue in our test environment with the information you have shared. We have logged this issue as EMAILNET-38629 for further investigation by the product team. We’ll let you know once there is any further progress or a fix version available in this regard.

The issues you have found earlier (filed as EMAILNET-38629) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.