S
susie
I have the following code to send out a test email to myself. I did not get any error message and has been informed that the email has been sent. However I never received the mail. Even if I am not online and run the following code, I still message that email has been sent. Any idea how to fix the problem? I checked my smpt server by typing "net start smtpsvc" at the command prompt, smtp server is starting all the time when I was running the code.
<%@ Page Language="VB" EnableSessionState="False" EnableViewState="False" Trace="False" Debug="true"%><%@ Import Namespace="System.Web.Mail" %><script language="VB" runat=server>
Sub Page_Load(Sender as Object, E as EventArgs)
If Page.IsPostBack Then
lblResponse.Text = "Your email has been sent."
End If
End Sub
Sub btn_Click(sender as Object, e as System.EventArgs)
Dim objEmail as New MailMessage(
objEmail.To = txtTo.Tex
objEmail.From = "(e-mail address removed)
'objEmail.Cc = txtCc.Tex
objEmail.Subject = "Test Email
'objEmail.Body = txtName.Text & ", " &txtComments.Tex
'objEmail.Priority = MailPriority.Hig
SmtpMail.SmtpServer = "localhost
tr
SmtpMail.Send(objEMail
Response.Write("Your E-mail has been sent sucessfully You"
catch exc as Exceptio
Response.Write("Send failure: " + exc.ToString()
End Tr
End Sub
</script><html><head><style>
..main {font-family:Verdana; font-size:12px;}
..title {font-family:Verdana; font-size:18px; font-weight:bold;}
</style></head><body><span class="title" align="center">Send email from
an ASP.NET page</span><br><br><asp:Label class="main" id="lblResponse"
runat="server"/><form method="POST" name="MainForm" runat="server"><table><tr><td class="main" align="right">Email:</td><td class="main"><asp:textbox id="txtTo" runat="server"/></td></tr><tr><td class="main" align="right">
Subject:</td><td class="main"><input type="text"
class="main" name="Subject" value=""></td></tr><tr><td class="main" align="right"
valign="top">Message:</td><td class="main"><textarea name="Message"
cols="50" rows="8"></textarea></td></tr><tr><td class="main"> </td><td class="main"><input type="Submit"
id="btnSubmit" OnServerClick="btn_Click" value="Send"
runat="server" /></td></tr></table></form></body></html
Thank you very much for your input
<%@ Page Language="VB" EnableSessionState="False" EnableViewState="False" Trace="False" Debug="true"%><%@ Import Namespace="System.Web.Mail" %><script language="VB" runat=server>
Sub Page_Load(Sender as Object, E as EventArgs)
If Page.IsPostBack Then
lblResponse.Text = "Your email has been sent."
End If
End Sub
Sub btn_Click(sender as Object, e as System.EventArgs)
Dim objEmail as New MailMessage(
objEmail.To = txtTo.Tex
objEmail.From = "(e-mail address removed)
'objEmail.Cc = txtCc.Tex
objEmail.Subject = "Test Email
'objEmail.Body = txtName.Text & ", " &txtComments.Tex
'objEmail.Priority = MailPriority.Hig
SmtpMail.SmtpServer = "localhost
tr
SmtpMail.Send(objEMail
Response.Write("Your E-mail has been sent sucessfully You"
catch exc as Exceptio
Response.Write("Send failure: " + exc.ToString()
End Tr
End Sub
</script><html><head><style>
..main {font-family:Verdana; font-size:12px;}
..title {font-family:Verdana; font-size:18px; font-weight:bold;}
</style></head><body><span class="title" align="center">Send email from
an ASP.NET page</span><br><br><asp:Label class="main" id="lblResponse"
runat="server"/><form method="POST" name="MainForm" runat="server"><table><tr><td class="main" align="right">Email:</td><td class="main"><asp:textbox id="txtTo" runat="server"/></td></tr><tr><td class="main" align="right">
Subject:</td><td class="main"><input type="text"
class="main" name="Subject" value=""></td></tr><tr><td class="main" align="right"
valign="top">Message:</td><td class="main"><textarea name="Message"
cols="50" rows="8"></textarea></td></tr><tr><td class="main"> </td><td class="main"><input type="Submit"
id="btnSubmit" OnServerClick="btn_Click" value="Send"
runat="server" /></td></tr></table></form></body></html
Thank you very much for your input