1 Replies - 990 Views - Last Post: 01 May 2010 - 10:18 AM

#1 alexjooris  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 28-April 10

'simple' contact form question

Posted 01 May 2010 - 08:26 AM

hi all.
I'm pretty new to the ASP.NET environment and would like to request some help of some ppl that know how to solve the following issue.

So i've made a webform in asp.net (c# in particular).
Very basic form
got a textbox "textBoxEmail" and a textbox "textBoxQuestion" and a button to send
so the user just can post his email address and his questing.

Here's my code i've got at the moment.

//text uit velden
        String vraag = textBoxQuestion.Text;
        String subject = "vraag vanop website";
        String to = "[email protected]";
        String from = textBoxEmail.Text;
        //mail maken
        MailMessage mail = new MailMessage();
        mail.From = new MailAddress(from);
        mail.To.Add(to);
        mail.Subject = subject;
        mail.IsBodyHtml = true;
        mail.Body = vraag;
        //verzenden
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "localhost";
        smtp.Send(mail);

        lblVerstuurd.Text = "Your email was sent";
        lblVerstuurd.Visible = true;


so when i try to run this it says error sending message.
i'm sure the problem is with the smtp commands...
i'm not really in to that kind of web coding.

any help would be nice

kind regards

Is This A Good Question/Topic? 0
  • +

Replies To: 'simple' contact form question

#2 codeaholic  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 06-November 09

Re: 'simple' contact form question

Posted 01 May 2010 - 10:18 AM

You could have the SMTP server configured on your machine incorrectly, or if you use windows Vista there could be no SMTP servers installed on your computer. You can download the smtp server from:
http://www.quiksoft.com/freesmtp/

This is is also a good tutorial for sending emails:
http://www.developer...-Send-Email.htm
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1