Migration from Aspose.Network

i’m migrating an old application, from the “very old” Aspose.Network…
there are a lot of deprecated and renamed members… anyway, i have a couple of problems/conflicts i’m not able to solve by myself:

- Aspose.Email.Pop3.Pop3Authentication [Auto, ClearText, CramMD5, DigestMD5, Login, Plain]
Can’t find that anymore… ?

- Aspose.Email.Mail.Attachment - property “ContentType” was a string. How should i convert it? should i replace it with “ContentType.MediaType” ?

- Aspose.Email.Mail.LinkedResource - lost properties: “Name” and “MediaType”

- Aspose.Email.Pop3.Pop3Client - i see that “Connect” and “Login” methods are deprecated.
i suppose now it is an “auto-connect”… how can i just test the connection (to check credentials/security) ?

Thank you

Best Regards,

Hi Andrea,

Thank you for contacting Aspose Support team.

  1. The ClearText, CramMD5 etc. are no more available and you may use the simplest form of the Pop3Cleint to initialize it. Unfortunately support of CramMD5, DigestMD5, never been implemented. There were only plans for theirs implementation. Enumeration, where these types of authentication have been mentioned, were never used. That’s why this enumeration is removed.

  2. You may use the ContentType.MediaType to get information about the media type of the attachment.

  3. Please use the LinkedResource.ContentType.Name and ContentType.MediaType to get this information.

  4. Yes, the API accesses the server on its first attempt to retrieve any data and Connect/Login methods are obsolete now. You can do a simple quick test for getting Mailbox information using the following code to determine the correctness of the credentials. It will raise exception if the credentials are not correct.


// Create a pop3client
Aspose.Email.Pop3.Pop3Client pop = new Aspose.Email.Pop3.Pop3Client(“[mail.domain.com](http://mail.domain.com/)”, “username”, “password”);
// Get the size of the mailbox
long nSize = pop.GetMailboxSize();
Console.WriteLine(“Mailbox size is " + nSize + " bytes.”);

thank you for the prompt reply…
i didn’t understand what do you mean with:


1. […] you may use the simplest form of the Pop3Cleint to initialize it. […]


Hi Andrea,

Following is the sample code to initiate Pop3Client.

Pop3Client client = new Pop3Client("http://pop.gmail.com/)", 995, "userName", "password");

client.SecurityOptions = SecurityOptions.Auto;

Please have a look at the articles on the following link for more information about Pop3:

Managing Email Messages with POP3 1

i run into another issue, about dates/time and timezones

with the old aspose.network mail message, i used to deal with "message.Date"
if i get it, it’s always in the correct timezone… if i set it with “DateTime.Now” it’s always set correctly.

Now, i’ve noticed that on the “new” Aspose.Email mail message, the property “Date” is not localized with the timezone, no more… so, how should i deal with getting/setting this property?
I’ve seen there is a “TimeZoneOffset” poperty… how should i use it? i think i have to migrate my code…



Hi Andrea,

You can get the message date in UTC by adjusting the Time zone offset information as shown in the following code sample. Please try it at your end and share your feedback with us.

Sample Code:

MailMessage eml = MailMessage.Load(“Sample.eml”);


Console.WriteLine(eml.Date + eml.TimeZoneOffset);

ok, so i have to replace my code, everywhere i read the message.Date, and add the timespan…
when i create a new message, i set the date with "message.Date = DateTime.Now"
should i change it?
should i set the zone timespan?



Hi Andrea,

MailMessage saves datetime in UTC format if no timezone offset is mentioned. For example its 07:26:39 PM on a system and it has timezone setting as +5 Hours, then it will write value in time header as Date: 8 Feb 2016 14:26:39 +0000.

If we set some time zone offset say, +4 hours on the same system, it will write the date header as Date: 8 Feb 2016 18:26:39 +0400.

If we set the time zone offset to some -ve value say -4 hours, it will write the date header as
Date: 8 Feb 2016 10:26:39 -0400.

We can see in all the examples above that absolute time is same in all the above case if we adjust the timezone value.

Different client applications like Outlook and Thunderbird display this time according to the local timezone setting of the system where this mail is opened.

Aspose.Email loads the UTC time into Date property and copies the timezone information into TimeZoneOffset property. We can display this date in any timezone by adding the required timezone as mentioned above.

Hope this clarifies the issue and should you have any other query in this regard, please feel free to write us back.

i understand the way to read it and show the local time to the client…
If i want to explicitly set the time of an outgoing message, how should i set it?
What is the “right” way?
And if i need to clone a message?



Hi Andrea,

Time cannot be set explicitly for an outgoing message as mail servers set their own times when processing the mails. So any explicit date time will be overwritten by the mail server.

Could you please explain what do you mean by clone a message? I will try to assist you once the detail is provided.

i know that mail servers add times and other stuffs to headers etc.
anyway, the “message datetime” is set by client. In fact, if you send emails from a mail client (thunderbird) from a PC with an incorrect datetime settings, when someone receives that message, the datetime of the message is incoerent.
With your component, is the same. If i set explicitly the message date, the email client receiving the email, shows the date set by ME… the servers on the way, just append some other dates. But the one showed, is the one set by my code.

In my case, i have an application developed with the “old” aspose.network library.
When the application sends the message, there is this code:

asposeMessage.Date = DateTime.Now;

Now, i changed the dll with the aspose.email, and i left the same code, and i compare the “old” messages, with the messages sent with the new DLL.
They have been sent with the same sender, same smtp server, same application.
If i open the messages with an email client, they both show the same date.
But if look at the “source” of the email, there is a difference:

This is sent with aspose.network:
Date: Tue, 9 Feb 2016 13:02:25 +0100
This is sent with aspose.email:
Date: 9 Feb 2016 12:02:25 +0000
It’s the same time, but the correct is the first.

Now, i suppose i have to set the date with:
DateTime dataOra = DateTime.Now;
asposeMessage.Date = dataOra;
asposeMessage.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(dataOra);
Is it correct?


Hi Andrea,

Thank you for writing back.

I have tested this issue by setting date to 2015 in my email and sent it out. At the receiving end, no such date was found and only server dates were found at the receiving end. The TimeZoneOffset property does have an impact on the date field in terms of time zones and it will create the similar time as you desire. But as mentioned earlier, we were not able to set the message date/time at our end and could find the server attached time only with the message. Please try it at your end and share your feedback with us for further assistance.

so, why the date header is different between the messages sent with aspose.network and aspose.email?
the newer is uncorrect.

Anyway, i’ve tested it right now… i can confirm you that, if i set an “incorrect” datetime to an aspose MailMessage Date property, i receive the email and my mailclient show it with that time. (incorrect)
Examining the message source, there are other headers with a date (added by the mail servers) but the date shown by the mail client is the one i set when i sent the message, with
message.Date = wrongDate;

How can i send you the message?



here is the message sent in year “2020” :slight_smile:

Hi Andrea,

I have tried the scenario with both Aspose.Email and Thunderbird, but could not observe the similar behavior as mentioned by you. In case of Aspose.Email I set wrong date but on receiving end, got the correct date i.e. UTC and incase of Thunderbird, got the date which was set on my system.

For further investigation, I would request you to provide detailed steps to re-produce the scenario here. Please share the following details which I should set for testing this issue:
  1. System timezone
  2. System date and time
  3. MailMessage.Date value
  4. Mail server (I used Gmail for sending and receiving)
  5. Thunderbird version to use
P.S. I will use latest library Aspose.Email for .NET 6.2.0.

sorry, i didn’t want to set the whole thread as private, just wanted to mark as private the post with the attachament.

anyway, i tested with the 6.2.0 and had the same behaviour… the date i see on the receiving client, is the date i set at code.

If I use gmail, instead, that date is overwritten with the correct “now”.
So, it’s a matter of SMTP server… i think the SMTP server of our ISP provider, doesn’t overwrite the date header, keeping the date provided by Aspose, while gmail rewrites it.

So, i suppose i have to edit my code to set the Aspose date/timezone properly.

Hi Andrea,

Yes, it seems to be a matter of SMTP server and you may set the Aspose Date/Timezone property as per your needs. If faced with any issue, please post your query to us for further assistance.

is this code ok?

DateTime serverNow = DateTime.Now;
asposeMessage.Date = serverNow.ToUniversalTime();
asposeMessage.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(serverNow);

And, about the reading messages from the pop3 server, i read the mail infos, with
but the “Pop3MessageInfo” class, doesn’t have a property with UTC offset… how can i get it?

thank you for support!


Hi Andrea,

You may please set date = DateTime.Now only and then set the timezone offset. There is no need to use ToUniversalTime.

Pop3MessageInfo contains the UTC date and hence can be displayed in any timezone by adding the required timezone.

ok, thank you!