Email To Multiple Users
Email To Multiple Users
using System.Net.Mail;
using System.Net;
namespace FileAndDocumentUploading.Controllers
{
public class SendMailController : Controller
{
//
// GET: /SendMail/
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.Body += "<tr>";
mail.Body += "<td>User Name : </td><td> HAi </td>";
mail.Body += "</tr>";
mail.Body += "<tr>";
mail.Body += "<td>Password : </td><td>aaaaaaaaaa</td>";
mail.Body += "</tr>";
mail.Body += "</table>";
mail.Body += "</body>";
mail.Body += "</html>";
mail.IsBodyHtml = true;
////System.Net.Mail.Attachment attachment;
////attachment = new System.Net.Mail.Attachment(@"D:\bkup\krishna.mdb");
////mail.Attachments.Add(attachment);
SmtpServer.Port = 587;
SmtpServer.Credentials = new
System.Net.NetworkCredential("[email protected]", "password");
http://ganeshmvc4.blogspot.in/p/using-system-using-system.html 1/2
8/27/2017 Email to multiple users
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
catch (Exception err)
{
}
return View();
}
}
}
http://ganeshmvc4.blogspot.in/p/using-system-using-system.html 2/2