Bash
[HttpPost] public ActionResult Index(MailModel objModelMail, HttpPostedFileBase fileUploader) { if (ModelState.IsValid) { string from = "[email protected]"; //example:- [email protected] using (MailMessage mail = new MailMessage(from, objModelMail.To)) { mail.Subject = objModelMail.Subject; mail.Body = objModelMail.Body; if (fileUploader != null) { string fileName = Path.GetFileName(fileUploader.FileName); mail.Attachments.Add(new Attachment(fileUploader.InputStream, fileName)); } mail.IsBodyHtml = false; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = true; NetworkCredential networkCredential = new NetworkCredential(from, "XXXX"); smtp.UseDefaultCredentials = true; smtp.Credentials = networkCredential; smtp.Port = 587; ParsingTemplate(); smtp.Send(mail); ViewBag.Message = "Sent"; return View("Index", objModelMail); } } else { return View(); } }I am trying to send one mail with Attachment using Mvc4.but it Takes time too long to send.more than 3 minutes its loaded finally am getting Timeout Error but small size of files no issues .now i want to send asyncronously Email has to be send...please if some one know this help me or share some links how to do that please help me ,

Ranjit PowarRank #553 · 4.4K reputationPosted Apr 20, 2016, 1:56 AM EDT
Amit Kumar SinghRank #562 · 4.3K reputationPosted Apr 20, 2016, 1:56 AM EDT
mari muthuRank #8,962 · 213 reputationPosted Apr 20, 2016, 3:10 AM EDT
Ranjit PowarRank #553 · 4.4K reputationPosted Apr 20, 2016, 3:13 AM EDT
mari muthuRank #8,962 · 213 reputationPosted Apr 20, 2016, 3:22 AM EDT
Ranjit PowarRank #553 · 4.4K reputationPosted Apr 20, 2016, 3:29 AM EDT
mari muthuRank #8,962 · 213 reputationPosted Apr 20, 2016, 4:32 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Apr 20, 2016, 5:45 AM EDT