How to send calendar invite inside the email? I have working email and below is the code. Now i want to add calendar invite inside of it. Can someone

  • Thread starter Thread starter Chintan_K
  • Start date Start date
C

Chintan_K

Guest
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Web;
using System.Web.Mvc;
using webAppointment.Models;

namespace webAppointment.Controllers
{
public class EmailController : Controller
{

private string Message { get; set; }

// GET: Email

//Welcome method
public void Welcome()
{
Message = "Thank you for joining us! We will provide you the best service.";
}

//Cancellation Message
public void Cancel()
{
Message = "We appologies for your service cancellation!";
}

[HttpPost]

public ActionResult Form(string receiverEmail, string SelectSubject, string message)
{

try
{
if (ModelState.IsValid)
{
var From = new MailAddress("abc@gmail.com", "Test Mail");
var TO = new MailAddress(receiverEmail, "Receiver");
var smtp = new SmtpClient

{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential("from@gmail.com", "password")
};

using (var mess = new MailMessage(From, TO)
{
Subject = SelectSubject,
Body = message
})

{
smtp.Send(mess);
}
Response.Write("Email sent!");
return View();

}
}
catch (Exception)
{
ViewBag.Error = "Couldn't send email.";
}
return View();
}
}
}

Continue reading...
 
Back
Top