I have these code from function.aspx
Sub Button1_Click(sender As Object, e As EventArgs)
' Call the SendMail function, and set Label1.Text to the
' recipient's e-mail address
Label1.Text = SendMail("Feedback form", TextBox1.Text, TextBox2.Text)
End Sub
Function SendMail(Subject As String, FromAddress As String, _
Message As String) As String
' Build a MailMessage
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mailMessage.From = "
[email protected]"
mailMessage.To = "
[email protected]"
mailMessage.Subject = "Sending an e-mail from a web page"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
' TODO: Set the mailMessage.Body property
mailMessage.Body = Message
System.Web.Mail.SmtpMail.SmtpServer = "mail.Fil-Can.ca"
System.Web.Mail.SmtpMail.Send(mailMessage)
SendMail = "Your message was sent to " & mailMessage.To
End Function
and I got these error message when I clicked the send button from chapter 4 function.aspx
Server Error in '/' Application.
The transport failed to connect to the server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Stack Trace:
[COMException (0x80040213): The transport failed to connect to the server.
]
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) +58
[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) +112
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1728
System.Web.Mail.SmtpMail.Send(MailMessage message) +150
ASP.Email_aspx.SendMail(String Subject, String FromAddress, String Message) +104
ASP.Email_aspx.Button1_Click(Object sender, EventArgs e) +58
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
Thank you in advance