1

SMTP Provider C# Code:

MailMessage Mail;

Mail.Attachments.Clear();

Byte[] bytes = System.Text.Encoding.ASCII.GetBytes(strICSData);

var ms = new MemoryStream(bytes);

var a = new Attachment(ms, "meeting111.ics", "text/calendar");

a.ContentDisposition.Inline = true;

Mail.Attachments.Add(a);

Here a.ContentDisposition.Inline Gets or sets a System.Boolean value that determines the disposition type (Inline or Attachment) for an e-mail attachment.

Above code is working fine and mapping my meeting to outlook calendar as shown below.

Find smtp screen shot after sending mail :enter image description here

Postmark Provider C# Code:

I am also using postmark provider for mail but i did not find any a.ContentDisposition.Inline = true; functionality.

Please find the below Postmark code :

PostmarkMessage message;

message.Attachments.Clear();

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(strICSData);

var ms = new MemoryStream(bytes);

message.AddAttachment(ms, "meeting111.ics", "text/calendar");

Below line, Adds a file stream with inline support:
message.AddAttachment(ms, "meeting.ics", "text/calendar");

Can anybody provide me solution so that postmark attachment is going to map to outlook calendar.

Nkosi
  • 191,971
  • 29
  • 311
  • 378
V Yadav
  • 11
  • 2
  • In order to get better outlook compatibility through our API, you'll need to set the ContentID for the attachment like the following: attachment.ContentID = "cid:meeting.ics" – V Yadav Jan 12 '18 at 19:22

1 Answers1

0

In order to get better outlook compatibility through our API, you'll need to set the ContentID for the attachment like the following:

attachment.ContentID = "cid:meeting.ics"

So we have to change
message.AddAttachment(ms, "meeting.ics", "text/calendar");

TO
message.AddAttachment(ms, "meeting.ics", "text/calendar","cid:meeting.ics");

V Yadav
  • 11
  • 2