Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have to send email form my contact us page in asp.net mvc4.
i am using
Name:
Contact:
Subject: dropdownlist
Message


please guide me what to do.
Posted
Comments
[no name] 2-Sep-13 9:06am    
"guide me what to do". first thing that you should do is learn a programming language to do this in. Then, write some code.
SDK03 2-Sep-13 9:38am    
Can you please explain in detail, what you want to accomplished. Do you want to send an email using MVC? Which will send Contact Form?
Please try something on your own and come back here if you face any problems.
HerambMK 4-Sep-13 0:36am    
You just need to send an email using MVC4, right?
If no then kindly clarify.
Also if you have tried something then post it here.
Leena 206 12-Sep-13 0:54am    
try smtp (simple mail trasfer protocol)
Regards :)

1 solution

C#
[HttpPost]
        public ActionResult Contact(string name, string subject, string contact, string company, string email, string message)
        {

            subject = " ABC ";
            var mailMessage = new System.Net.Mail.MailMessage();
            mailMessage.To.Add(email);
            mailMessage.IsBodyHtml = true;
            mailMessage.Subject = subject + "";
            var smtpClient = new SmtpClient { EnableSsl = true };
            smtpClient.Send(mailMessage);
            ViewBag.Message2 = "Mail Sent Successfully, Thanks for contact !";
            return View();
        }
 
Share this answer
 

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