SIGN UP MEMBER LOGIN:    
ARTICLE

Construct and Send an ICS file as an attachment in the Email

Posted by Suri meenakshi Sundaram Articles | ASP.NET Programming October 26, 2010
In this article I will explain how we can construct the ICS file and send as an attachment in the Email.
Reader Level:
 

Here I will explain it in detail, how we can construct the ICS file and send as an attachment in the email. 

First create a method

public void SendmailWithIcsAttachment()
{
    1.gif      
    //Now we have to set the value to Mail message properties. As shown below.
    2.gif
    //Note Please change it to correct mail-id to use this in your application
    msg.From = new MailAddress("xxxxx@xyz.com", "ABC");
    msg.To.Add(new MailAddress("yyyyy@xyz.com", "BCD"));
    msg.CC.Add(new MailAddress("zzzzz@xyz.com", "DEF"));// it is optional, only if required
    msg.Subject = "Send mail with ICS file as an Attachment";
    msg.Body = "Please Attend the meeting with this schedule";
    msg.Subject = "Send mail with ICS file as an Attachment";
    msg.Body = "Please Attend the meeting with this schedule";  
        
    3.gif       

Now will see the Sending mail part

4.gif 

}

Happy Coding!!!

Login to add your contents and source code to this article
share this article :
post comment
 

Hi Suri, I tried the "AlternateView", and it works fine. Thanks. The problem I'm facing now is that when there are attachments to the message, then the Calendar Event (.ics) is not displayed. It displays as an standard Outlook message with the attachment. Any ideas?

Posted by Luis Ledesma May 03, 2012
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor