I am trying to send Image with the mail using below code but mail send to the user only recieves in string format.
[HttpPost]
public ActionResult SignUp(tbuser user)
{
try
{
var uemail = user.uemail;
var upassword = user.upassword;
db.tbusers.Add(user);
db.SaveChanges();
MailMessage mail = new MailMessage();
mail.To.Add(uemail);
mail.From = new MailAddress("nadeem786chd@gmail.com");
mail.Subject = "Confirmation mail from site";
string path = Server.MapPath(@"~/Content/images/istmailer2.gif");
String Body = "";
LinkedResource logo = new LinkedResource(path);
logo.ContentId = "Advertisement Logo";
Body = Body + logo;
Body = Body + "
";
Body = Body + "You Have Successfully created your Account on GoAir Please login to your account using your Login Mail and Pass word";
Body = Body + "You will be redirected to website's Login Page ";
Body = Body + "Your Email: " + uemail;
Body = Body + "Password: " + upassword;
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential
("cssoft.net@gmail.com".Trim(), "lkjI*&yu&".Trim());
smtp.EnableSsl = true;
smtp.Send(mail);
}
catch
{
}
return View("SignIn");
}