hi what is wrong please with the following code which is supposed to send an email from a feedback form. Thanks <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Page Language="VB" AutoEventWireup="false" %> <%@ Import Namespace="System.Net.Mail" %> +++++++++++++ <asp:textbox Runat="server" id="Name" Width="400" ></asp:textbox> <asp:textbox id="Email" Width="400" Runat="server"></asp:textbox> <asp:textbox id="Subject" Width="400" Runat="server"></asp:textbox> <asp:textbox id="Message" Width="100%" Runat="server" Height="140" TextMode="MultiLine" MaxLength="400"></asp:textbox> <asp:button id="btnSendmail" Runat="server" Text="Send email" OnClick="btnSendmail" Font-Bold="true"></asp:button> code behind Partial Class send_MailMessage Inherits System.Web.UI.Page Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) Dim name As String = "" Dim mailTo As String = "" Dim mailSubject As String = "" Dim mailBody As String = "" Dim myMail As New System.Net.Mail.MailMessage("[email protected]", mailTo, mailSubject, mailBody) myMail.IsBodyHtml = True Try Dim c As New System.Net.Mail.SmtpClient() c.Send(myMail) mailSubject = "" mailBody = "" Catch myEx As System.Net.Mail.SmtpException System.Diagnostics.Debug.WriteLine("Error sending mail: " & myEx.Message) Throw myEx Finally myMail = Nothing End Try End Sub End Class
It doesn't appear that you've setup an SMTP host in your code. Please refer to this Knowledge Base article for sample code: http://support.discountasp.net/KB/a364/how-to-send-email-in-aspnet-20.aspx