Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

.NET Forum


You are currently viewing our .NET Forum as a guest. Please register to participate.
Login



Reply
Old 05-07-2009, 04:11 PM Contact form
Average Talker

Posts: 26
Name: Adam Kischinovsky
Trades: 0
Hi, I'm trying to make a contact form, but it won't send the e-mail when I press send.
It doesn't make an error, just nothing happens.
I really don't know what the problem can be.
I'm doing it in .net c#

here is my code from my cs page:

Code:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class dkkontakt : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void submit_click(object sender, EventArgs e)
    {
        MailMessage Emailmsg = new MailMessage("noreply@hotmail.com", "mymail@hotmail.com");
        Emailmsg.Subject = "Kontaktform";
        Emailmsg.Body += "E-mail" + email.Text;
        Emailmsg.Body += "Navn: " + name.Text;
        Emailmsg.Body += "Tekst: " + besked.Text;
        
       

    }

}

Hope someone can see the problem and help me?

thanks
Kischi is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-07-2009, 08:08 PM Re: Contact form
Extreme Talker

Posts: 246
Trades: 0
have you bound the click event to the submit button control.
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 05-30-2009, 05:44 PM Re: Contact form
Novice Talker

Posts: 9
Trades: 0
I neither see the setup of a SMTP host for sending nor the final message send command. As far as I see you only setup the message itself.
sabsch is offline
Reply With Quote
View Public Profile
 
Old 05-30-2009, 06:52 PM Re: Contact form
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
You need to instantiate an SmtpClient object and use it to send the mail.

ref:
http://msdn.microsoft.com/en-us/libr...ilmessage.aspx

On a side note. Once you get it working, I'd recommend that you create a job queue for mail messages. When the request comes in, create the message and drop it on the queue. A worker thread can be in charge of sending messages and emptying the queue.

This will keep pages from waiting on mail servers and can reduce the load on your server.
__________________

Please login or register to view this content. Registration is FREE


Last edited by willcode4beer; 05-30-2009 at 06:54 PM..
willcode4beer is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Contact form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13135 seconds with 12 queries