Click here to Skip to main content
15,860,861 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
can anybody help me in my requirement. I have four text boxes like username,useremail id,phone number and inquiry,when i clicked the sendmail button, text boxes data should come to my email id. Where useremail is visitor email id.
Posted
Updated 9-Jan-12 17:49pm
v2

Hi,

You need to use System.Net.Mail.MailMessage class to send emails.

Please look into http://msdn.microsoft.com/en-us/library/system.web.mail.mailmessage%28v=vs.71%29.aspx
 
Share this answer
 
v2
System.Net.NetworkCredential SmtpCredential = new System.Net.NetworkCredential();
System.Net.Mail.SmtpClient smClient;
SmtpCredential = new System.Net.NetworkCredential("mail@website.com", "password");
smClient = new System.Net.Mail.SmtpClient("mail.website.com");// SMTP Server of website
smClient.EnableSsl = true;//is Website Supports SSL e.g: https:
smClient.UseDefaultCredentials = false; 
smClient.Credentials = SmtpCredential;

_MailMessage.To.Add("youremailid@website.com");
_MailMessage.From = "visitoremailid@website.com";
_MailMessage.Body = "textbox values";
_MailMessage.Subject = "subject";
_MailMessage.IsBodyHtml = true;

smClient.Send(_MailMessage);
 
Share this answer
 
See this code it may help you for sending mail in c#.net

using System.Net.Mail;

MailMessage mail = new MailMessage();
mail.To.Add("YourMailId@gmail.com");
mail.From = new MailAddress("YourmailId@gmail.com");

mail.Subject = "Full Details of Your TextBoxs";
string Body = "UserName "+TextBox1.Text;
Body += "UserEmail  "+TextBox2.Text;
Body += "Phone number  "+TextBox3.Text;
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";

string EmailId ="Your MailId";
string EmailPassword = "Your mail Password";
smtp.Credentials = new System.Net.NetworkCredential(EmailId, EmailPassword);
smtp.EnableSsl = true;
smtp.Send(mail);
 
Share this answer
 
v3

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