.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

how to send e-mail from site to admin

Posted By: shahin     Posted Date: November 03, 2008    Points:2   Category :C#
can anyone send me code for sending mail from site ?

Responses
Author: Rahul             
Posted Date: November 04, 2008     Points: 5   

Hi,
Refer this post for coding.

http://www.dotnetspark.com/Forum/4-how-to-send-mail-asynchronously-asp-net.aspx

Author: krishana singh             
Posted Date: October 16, 2010     Points: 5   

protected void hrfSubmit_ServerClick(object sender, EventArgs e)
{
try
{
if (con.State == ConnectionState.Open)
con.Close();
con.Open();
string insertcontact = "INSERT INTO tblContactUs(Uname,Address,Mobile,Email,Comment) VALUES('" + txtname.Text + "','" + txtadd.Text + "','" + txtmobile.Text + "','" + txtemail.Text + "','" + txtcomment.Text + "')";
SqlCommand cmd = new SqlCommand(insertcontact,con);
cmd.ExecuteNonQuery();
txtadd.Text = txtemail.Text = txtemail.Text = txtcomment.Text = txtname.Text = txtmobile.Text = "";

string bodytext = "<html>";
bodytext += "<table border='1'>";
bodytext += "<tr><td>Name: </td><td>'" + txtname.Text + "'</td></tr><br/>";
bodytext += "<tr><td>EmailID: </td><td>'" + txtemail.Text + "'</td></tr><br/>";
bodytext += "<tr><td>Mobile:</td><td>'" + txtmobile.Text + "'</td></tr><br/>";
bodytext += "<tr><td>Address:</td><td>'" + txtadd.Text + "'</td></tr><br/>";
bodytext += "<tr><td>Comment</td><td>'" + txtcomment.Text + "'</td></tr><br/>";
bodytext += "</table>";
bodytext += "</html>";
Email.SendMail(txtemail.Text, "info@theflowersworld.com", "Contact information", bodytext);
Email.SendMail("info@theflowersworld.com", txtemail.Text, "confirmation mail", "your information saved successfully ");
}
catch (Exception ex)
{

txtadd.Text = txtemail.Text = txtemail.Text = txtcomment.Text = txtname.Text = txtmobile.Text = "";
}
}

Author: Ashutosh Jha             
Posted Date: December 26, 2013     Points: 20   


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend