.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 >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

EMail Sending

Posted By: Aamrapali Tamgadge     Posted Date: January 27, 2011    Points:2   Category :ASP.Net
Hi.M Having one enquiry form in my website wen any user fill this enquiry form i want to send this enquiry details To my userid with the user details who is filling dat form how can i do this please anyone help me out its argent...

Responses
Author: Amit Mehra             
Posted Date: January 28, 2011     Points: 5   

Hi,

You can use MailMessage class to send mail..The best way use stringBuilder class to build html string and assign this string to mail body.

hope this will give you an idea

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Blessy Baby             
Posted Date: February 02, 2011     Points: 5   

hi

try this like

public static void SendMail(string fromAddress
, string toAddress
, string subject
, string content
, string host
, int port
, string userName
, string password
, string ccAddress)
{


using (MailMessage mailMessage = new MailMessage(fromAddress, toAddress, subject, content))
{
mailMessage.IsBodyHtml = true;
MailAddress mailAddress = new MailAddress(ccAddress);
mailMessage.CC.Add(mailAddress);
SmtpClient mailClient = new SmtpClient();
mailClient.Host = host;
if (port != 0)
{
mailClient.Port = port;
}
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
if (!string.IsNullOrEmpty(userName))
mailClient.Credentials = new NetworkCredential(userName, password);
mailClient.Send(mailMessage);

}

}

Blessy Baby
Project Lead
Digitalmesh Softech India (p) Limited
Cochin,Kerala


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