Hello,
I get this message when I run the following code:
The code is from ASP.Net WEB MATRIX PROJECT guided tour.
Ive gone over this many times to make sure that I followed the steps in the tour correctly.
I have WindowsXP, OfficeXP, .Net v1.1, & Visual Studio. I am using the Web Matrix Program To Build These tutorials. Default WinXP virtual SMTP server (default settings).
I do not know if I have to or how to set up email accts on my own SMPT server -- if that is required for this.
I am trying to send myself a test message using My email address in both to/from boxes. The email address i am using is through a provider - RR-. use cable modem....
The following code and a single form is all there is to this email sender app. the form opens fine. I get the error when I click the SEND button(1).
Thanks for any input,
whill1
I get this message when I run the following code:
The code is from ASP.Net WEB MATRIX PROJECT guided tour.
Ive gone over this many times to make sure that I followed the steps in the tour correctly.
I have WindowsXP, OfficeXP, .Net v1.1, & Visual Studio. I am using the Web Matrix Program To Build These tutorials. Default WinXP virtual SMTP server (default settings).
I do not know if I have to or how to set up email accts on my own SMPT server -- if that is required for this.
I am trying to send myself a test message using My email address in both to/from boxes. The email address i am using is through a provider - RR-. use cable modem....
The following code and a single form is all there is to this email sender app. the form opens fine. I get the error when I click the SEND button(1).
Thanks for any input,
whill1
Code:
<%@ Page Language="VB" %>
<script runat="server">
' Insert page code here
'
Sub Button1_Click(sender As Object, e As EventArgs)
Try
' Build a MailMessage
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mailMessage.From = TextBox2.Text
mailMessage.To = TextBox1.Text
mailMessage.Subject = TextBox3.Text
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Html
mailMessage.Body = TextBox4.Text
System.Web.Mail.SmtpMail.SmtpServer = "localhost"
System.Web.Mail.SmtpMail.Send(mailMessage)
Label2.Text = "Your Mail Was Sent."
Catch exp As Exception
Label2.Text = "There was an error sending mail: " & exp.Message
End Try
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p>
<asp:Label id="Label1" runat="server">E-Mail</asp:Label>
</p>
<p>
<asp:Label id="Label2" runat="server" forecolor="Red"></asp:Label>
</p>
<p>
<table width="80%">
<tbody>
<tr>
<td>
<span><label><asp:Label id="Label3" runat="server">To:</asp:Label></label></span></td>
<td>
<asp:TextBox id="TextBox1" runat="server">whill1@wi.rr.com</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label id="Label4" runat="server">From:</asp:Label></td>
<td>
<asp:TextBox id="TextBox2" runat="server">whill1@wi.rr.com</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label id="Label5" runat="server">Subject:</asp:Label></td>
<td>
<asp:TextBox id="TextBox3" runat="server">This is a Test</asp:TextBox>
</td>
</tr>
<tr>
<td valign="top">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Send"></asp:Button>
</td>
<td>
<asp:TextBox id="TextBox4" runat="server" TextMode="MultiLine" Width="100%" Rows="10">If you can read this my new program works!</asp:TextBox>
</td>
</tr>
</tbody>
</table>
</p>
<!-- Insert content here -->
</form>
</body>
</html>