小编Raj*_*har的帖子

使用C#创建ics文件并发送带有附件的电子邮件

我需要发送带有ics文件的日历约会电子邮件,附件中包含约会详细信息,我收到邮件,但是缺少附件帮助我,有人可以解决此问题

需要创建简单的ics文件,并将其与电子邮件一起附加。

我尝试时请看下面的代码

   public IHttpActionResult cal(calendar objApptEmail)
    {
        MailMessage msg = new MailMessage();
        //Now we have to set the value to Mail message properties

        //Note Please change it to correct mail-id to use this in your application
        msg.From = new MailAddress("ssss@gmail.com", "ABC");
        msg.To.Add(new MailAddress("ssss@outlook.com", "BCD"));
        //  msg.CC.Add(new MailAddress("zzzzz@xyz.com", "DEF"));// it is optional, only if required
        //   msg.Headers.Add("Content-class", "urn:content-classes:calendarmessage");
        msg.Subject = "Send mail with ICS file as an Attachment";
        msg.Body = "Please Attend the meeting with this schedule";

        // Now Contruct …
Run Code Online (Sandbox Code Playgroud)

c# outlook

2
推荐指数
2
解决办法
4917
查看次数

标签 统计

c# ×1

outlook ×1