Error of System.TypeInitializationException: 'The type initializer for '#=zCMIThOB2qmvZFW_Ifh4QKFf70WB9CEe4Rw==' threw an exception while using Aspose.Email version 23.10

Hi, I am using Aspose.Email for Outlook reminder and it throwing below error

System.TypeInitializationException: 'The type initializer for ‘#=zCMIThOB2qmvZFW_Ifh4QKFf70WB9CEe4Rw==’ threw an exception
Inner Exception
NotSupportedException: No data is available for encoding 860. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

My Code is:
List data = new List();
data = list.Select(x => x).Where(x => x.ContactDate == item).ToList();
DateTime RemindDate = DateTime.UtcNow;

            foreach (var obj in data)
                body.Append("<ul style='list-style-type: square;'>");
                body.Append("<li>Client Name : " + obj.ClientName + "");
                body.Append("<br>Candidate Name : " + obj.CandidateName + " (" + obj.RefNo + ") " + "");
                body.Append("<br>Check Name :" + obj.CheckName);
                body.Append("<br>Contact Date : " + obj.ContactDate + "");
                body.Append("<br>Reason : " + obj.Reason + "");
                body.Append("</li><br />");

            Aspose.Email.License license = new Aspose.Email.License();
            DateTime EndTime = DateTime.Parse(item).Date.Add(new TimeSpan(23, 59, 00)).ToUniversalTime();
            var contact_date = DateTime.Parse(item).Date;
            if (contact_date < DateTime.Now.Date)
                RemindDate = DateTime.Parse(item);
            var enc = CodePagesEncodingProvider.Instance.GetEncoding(1252);
            Aspose.Email.Calendar.Appointment app = new Aspose.Email.Calendar.Appointment("HK", RemindDate.ToUniversalTime(), EndTime, "", supervisorEmail);
            app.Summary = "Future employment check reminder from [" + RemindDate.ToString("dd-MM-yyyy") + "] to [" + EndTime.ToString("dd-MM-yyyy") + "]";
            app.MethodType = AppointmentMethodType.Publish;
            Aspose.Email.MailMessage msg = new Aspose.Email.MailMessage("",supervisorEmail);

            msg.HtmlBody = body.ToString(); //Setting Email Body.
            msg.IsBodyHtml = true; //Setting Email Body type HTML.
            msg.PreferredTextEncoding = Encoding.GetEncoding(1252);

            Aspose.Email.AlternateView view = app.RequestApointment();

            //msg.To = supervisorEmail;
            //msg.From = "";
            //var enc = CodePagesEncodingProvider.Instance.GetEncoding("UTF8");
            //Stream str = new MemoryStream();
            MapiConversionOptions conversionOptions = new MapiConversionOptions();
            conversionOptions.Format = OutlookMessageFormat.Unicode;
            conversionOptions.ForcedRtfBodyForAppointment = false;
            Aspose.Email.Mapi.MapiMessage mapi = Aspose.Email.Mapi.MapiMessage.FromMailMessage(msg,conversionOptions);//error throws here
            Aspose.Email.Mapi.MapiCalendar calendar = (Aspose.Email.Mapi.MapiCalendar)mapi.ToMapiMessageItem();
            calendar.ReminderSet = true;
            calendar.ReminderDelta = 1;

Can please help to solve the issue


Could you please provide a saved eml file to reproduce the issue at our end?

Thank you.

Hi @margarita.samodurova Thanks for reply.

I have no saved eml file. I am creating html body at runtime and setting the reminder. With my earlier code in MVC application using version 6.9 it was running, but not running When I added same in .netcore application. It was throwing error of unable to set license. Then I upgrade dll to version of 23.10 and license issue resolved with current license. But above error remain as I changed code according to new dll.

Can you please use same code as above and provide solution.


Hi ,

We are unable to reproduce the error.
It should be noted that the .NET Core version has a dependency on the following libraries:

  • System.Text.Encoding.CodePages (>= 5.0.0)
  • System.Security.Cryptography.Pkcs (>= 7.0.3).

Can you confirm that the above dependencies are added to your project?
P.S.: If you add Aspose.Email dll with NuGet, these dependencies are automatically added to the project.

Hi @margarita.samodurova ,

These 2 was not added in project. Now added but still getting same error.

image.png (3.4 KB)
image.png (71.0 KB) ,

The problem is obviously with the environment settings. Please let us know which OS and Visual Studio versions you’re using.

Hi @margarita.samodurova Thanks for your help.

I removed above two nuget packages and also removed dll from project.
Then added from nuget package and it works. Oulook reminder set with body defined.

Hi ,

Thank you for using Aspose products.

If you have any other questions, please feel free to ask.