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

In this article I will explain how we can construct the ICS file and send as an attachment in the Email.


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!!!