if user enter his details like name,email,ph no etc..then click on send button in contactusaspx page..then how to get his details ,who maintainced that particular website.
Thanks,
Pavan.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shourya VerdhanPosted Dec 2, 2015, 4:17 AM
if you want to do that so there is two ways to get user details,
2.By Store in your DB.
so you need to call this code for that, just replace your email address , password and MyMailMessage.Body of your text boxex
string pass = "***"; // Password of the given email addess
string host = "mail.abc.com"; // server name of mail or Host name
string strret = "";
string to = "[email protected]"; // to whom you want to send mail
string cc = "[email protected]"; //if you like to send as cc as well
System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage();
MyMailMessage.Subject = "Suject"; // Subject of mail
MyMailMessage.Body = "Message"; //What you want in mail like Name="txtname.text"+ mobile="txtmob.text";
MyMailMessage.From = new MailAddress("[email protected]");
if (to != "")
{
string[] toMailid = to.Split(new char[] { ',' });
for (int i = 0; i < toMailid.Length; i++)
{
MyMailMessage.To.Add(toMailid[i]);
}
}
if (cc != "")
{
string[] ccMailid = cc.Split(new char[] { ',' });
for (int i = 0; i < ccMailid.Length; i++)
{
MyMailMessage.CC.Add(ccMailid[i]);
}
}
System.Net.Mail.MailAddress ad = new System.Net.Mail.MailAddress("[email protected]");
MyMailMessage.ReplyTo = ad;
MyMailMessage.IsBodyHtml = true;
System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential(username, pass);
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient(host);
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.EnableSsl = false;
try
{
mailClient.Send(MyMailMessage);
}
catch (System.Exception ex)
{
strret = ex.Message.ToString();
}