I send a mail with an ics attachment, but it is not working. see the snapshot
error message snapshot error01.png (71.6 KB)
here is all of the code:
private void button4_Click(object sender, EventArgs e)
{
Aspose.Email.License license = new Aspose.Email.License();
if (!license.IsLicensed)
{
//放在內嵌資源
license.SetLicense(“Aspose.Email.lic”);
}
MailMessage MailMessage = new MailMessage();
#region Sender (作為主要退信address)
MailMessage.Sender = "support@dajinsoft.com";
MailMessage.Sender.DisplayName = "達璟資訊 Dajinsoft";
#endregion
#region From
MailMessage.From = "crm@dajinsoft.com";
MailMessage.From.DisplayName = "達璟資訊";
#endregion
#region To
MailMessage.To.Add("carlos_liu@dajinsoft.com");
#endregion
#region Content
MailMessage.Subject = "TEST ICS";
MailMessage.HtmlBody = "TEST ICS";
//MailMessage.IsBodyHtml = true;
#endregion
#region ics attachment
string dataDir = @"c:\";
// Create Appointment
string Summary = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes("Summary 摘要"));
string Description = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes("Descripttion 說明"));
//RecurrencePattern pattern = new DailyRecurrencePattern(new DateTime(2024, 7, 10));
//pattern.Interval = 8;
MonthlyRecurrencePattern pattern2 = new MonthlyRecurrencePattern();
pattern2.Interval = 3;
pattern2.StartOffset = 5;
pattern2.EndDate = new DateTime(2024, 7, 10);
Appointment app = new Appointment("", Summary, Description, new DateTime(2019, 7, 10, 9, 0, 0, 0), new DateTime(2019, 7, 10, 10, 0, 0, 0), "carlos_liu@dajinsoft.com", null, pattern2);
MailMessage msg = new MailMessage();
msg.AddAlternateView(app.RequestApointment());
//Joanne: 要加這段中文字才不會變亂碼
MapiMessage mapi = MapiMessage.FromMailMessage(msg, MapiConversionOptions.UnicodeFormat);
MapiCalendar calendar = (MapiCalendar)mapi.ToMapiMessageItem();
// Set calendar Properties
//calendar.ReminderSet = true;
//calendar.ReminderDelta = 45;//45 min before start of event
string savedFile = (dataDir + "/ScheduleFromCRM_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".ics");
calendar.Save(savedFile, AppointmentSaveFormat.Ics);
MailMessage.Attachments.Add(new Attachment(savedFile));
#endregion
MailMessage.BodyEncoding = Encoding.UTF8;
MailMessage.SubjectEncoding = Encoding.UTF8;
MailMessage.PreferredTextEncoding = Encoding.UTF8;
SmtpClient client = new SmtpClient();
client.Host = "exmail.dajinsoft.com";
client.Username = "crm@dajinsoft.com";
client.Password = "1qaz@WSX";
client.Port = 25;
//client.UseAuthentication = false;
//client.SupportedEncryption = Aspose.Email.Clients.Base.EncryptionProtocols.Ssl2;
client.SecurityOptions = SecurityOptions.None;
client.Send(MailMessage);
}
I have observed the image shared by you and unfortunately unable to translate the content of error on my end in English. Can you please be kind enough to share details of issue along with message translation. I also suggest you to please first try using latest Aspose.Email for .NET 19.6 on your end as well.
The error means the operation is failure. and here is the ics file, you can double click to show the error message in you outlook ScheduleFromCRM_20190710095624.zip (698 Bytes)
I have tried opening the attached ICS file on my end in Outlook 2016 and have not been able to observe any issue. Can you please share the Outlook version used on your end to reproduce the issue. Can you please also share if you have used latest Aspose.Email for .NET 19.6 on your end as well.
I use Outlook 2013, and Aspose.Email .NET 19.4, Do I get a trial version for Aspose.Email 19.6 ?
Does Aspose.Email support to remove old event from an ics calendar file ?
I regret to inform that it is not possible using Aspose.Email. Also you may use one month trial version.