You must Sign In to post a response.
  • Category: Windows 8

    Contact form send email

    hi,
    I am creating website in asp.net in html.now i want to send message using email in contact form.how it is possible...
    Thank you
  • #769992

    Here's the Article I have written a few years ago it will help you please check.

    https://www.dotnetspider.com/resources/31374-Export-Grid-To-excel.aspx


    Thanks and Regards
    Miss Meetu Choudhary (Site Coordinator)
    Go Green Save Green

  • #769993
    when i check the above link and i got the erorr like System.Net.Mail.SmtpException: Failure sending mail. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Net.BufferBuilder.Append(String value) at System.Net.Mail.AuthCommand.PrepareCommand(SmtpConnection conn, String message) at System.Net.Mail.AuthCommand.Send(SmtpConnection conn, String message) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at contactus.btnSend_Click(Object sender, EventArgs e) in d:\website\contactus.aspx.cs:line 143

  • #769994
    This code is definitely working i have tried and tested. kindly make sure you have all required reference files in place.
    Thanks and Regards
    Miss Meetu Choudhary (Site Coordinator)
    Go Green Save Green

  • #770025
    Hi

    Can you try this code

    MailMessage message = new MailMessage();
    SmtpClient smtp = new SmtpClient();
    message.From = new MailAddress("FromMailAddress");
    message.To.Add(new MailAddress("ToMailAddress"));
    message.Subject = "Test";
    message.IsBodyHtml = true; //to make message body as html
    message.Body = htmlString;
    smtp.Port = 587;
    smtp.Host = "smtp.gmail.com"; //for gmail host
    smtp.EnableSsl = true;
    smtp.UseDefaultCredentials = false;
    smtp.Credentials = new NetworkCredential("kumaraspcode2009@gmail.com", "password");
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    smtp.Send(message);

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments