public virtual MvcMailMessage SendEmail(ExampleEmailModel model)
        {
            var mailMessage = new MvcMailMessage
            {
                Subject = model.Subject
            };

            mailMessage.To.Add(model.To);

            if (model.Bcc != null)
                mailMessage.Bcc.Add(model.Bcc);

            if (model.attachmentPath1 != null)
                mailMessage.Attachments.Add(new Attachment(model.attachmentPath1));

            // Use a strongly typed model
            ViewData = new ViewDataDictionary(model);
            if (model.FormatId == 1)
            {
                PopulateBody(mailMessage, "Template1", null);
            }
            else
                if (model.FormatId == 2)
                {
                    PopulateBody(mailMessage, "Template2", null);
                }

            return mailMessage;
        }
        public ActionResult Index()
        {
            var EmailContent = new ExampleEmailModel();
            EmailContent.To = "*****@*****.**";
            EmailContent.Fname = "First";
            EmailContent.Lname = "Last";
            EmailContent.Subject = "Testing email";
            EmailContent.FormatId = 1;

            SampleMailer.SendEmail(EmailContent).Send();

            return View();
        }