Click here to Skip to main content
15,878,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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");
}
Posted

 
Share this answer
 
Thank You Sir for soon reply
I have One more query that How I can generate pdf of book ticket details and send via email to user.

I am making a website on Online Airlines ticket booking please reply asap.
Thank You!
 
Share this answer
 
Comments
Deepu S Nair 22-Mar-15 6:23am    
Don't post your question as comment

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900