R
RAB
I have a .aspx page with the following code:
<% @Import Namespace="System.Web.Mail" %>
<%@ page language="vb" debug="true" runat="server" %>
<script runat="server">
Sub Click(sender as Object, e as EventArgs)
'Create an instance of the MailMessage class
Dim objMM as New MailMessage()
'Set the properties - send the email to the person who filled out the
'feedback form.
objMM.To = "(e-mail address removed)"
objMM.From = txtEmail.Text
'If you want to CC this email to someone else, uncomment the line
below
'objMM.Cc = ""
'If you want to BCC this email to someone else, uncomment the line
below
'objMM.Bcc = "(e-mail address removed)"
'Send the email in text format
objMM.BodyFormat = MailFormat.Text
'(to send HTML format, change MailFormat.Text to MailFormat.Html)
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
'Set the subject
objMM.Subject = "Hello"
'Set the body
objMM.Body = txtMessage.Text
'Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub
</script>
<html>
<head>
<title>AnyPage</title>
</head>
<body>
<form runat="server">
<b>Your Email Address:</b>
<asp:textbox id="txtEmail" runat="server" />
<asp:requiredfieldvalidator controltovalidate="txtEmail"
runat="server"
Errormessage="Please enter an email address.">
</asp:requiredfieldvalidator><br>
<asp:RegularExpressionValidator
id="valUrl"
ControlToValidate="txtEmail"
Text="(invalid email address)"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Runat="Server" />
</asp:RegularExpressionValidator>
<p>
<b>Your Message:</b><br>
<asp:textbox id="txtMessage" TextMode="MultiLine"
Columns="40" Rows="10"
runat="server" />
<asp:requiredfieldvalidator controltovalidate="txtMessage"
runat="server"
Errormessage="Please enter a message.">
</asp:requiredfieldvalidator>
<p>
<asp:button runat="server" id="btnSendFeedback" Text="Send
Email"
OnClick="Click" />
<aspanel id="panelMailSent" runat="server" Visible="False">
An email has been sent. Thanks!
<br><br>
</aspanel>
<br><br><br><br>
</form>
</body>
</html>
My question is, if my code sends this email and the email is
undeliverable. How can I notify myself of this information?
Thanks,
RABMissouri2006
<% @Import Namespace="System.Web.Mail" %>
<%@ page language="vb" debug="true" runat="server" %>
<script runat="server">
Sub Click(sender as Object, e as EventArgs)
'Create an instance of the MailMessage class
Dim objMM as New MailMessage()
'Set the properties - send the email to the person who filled out the
'feedback form.
objMM.To = "(e-mail address removed)"
objMM.From = txtEmail.Text
'If you want to CC this email to someone else, uncomment the line
below
'objMM.Cc = ""
'If you want to BCC this email to someone else, uncomment the line
below
'objMM.Bcc = "(e-mail address removed)"
'Send the email in text format
objMM.BodyFormat = MailFormat.Text
'(to send HTML format, change MailFormat.Text to MailFormat.Html)
'Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
'Set the subject
objMM.Subject = "Hello"
'Set the body
objMM.Body = txtMessage.Text
'Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
'Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub
</script>
<html>
<head>
<title>AnyPage</title>
</head>
<body>
<form runat="server">
<b>Your Email Address:</b>
<asp:textbox id="txtEmail" runat="server" />
<asp:requiredfieldvalidator controltovalidate="txtEmail"
runat="server"
Errormessage="Please enter an email address.">
</asp:requiredfieldvalidator><br>
<asp:RegularExpressionValidator
id="valUrl"
ControlToValidate="txtEmail"
Text="(invalid email address)"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Runat="Server" />
</asp:RegularExpressionValidator>
<p>
<b>Your Message:</b><br>
<asp:textbox id="txtMessage" TextMode="MultiLine"
Columns="40" Rows="10"
runat="server" />
<asp:requiredfieldvalidator controltovalidate="txtMessage"
runat="server"
Errormessage="Please enter a message.">
</asp:requiredfieldvalidator>
<p>
<asp:button runat="server" id="btnSendFeedback" Text="Send
Email"
OnClick="Click" />
<aspanel id="panelMailSent" runat="server" Visible="False">
An email has been sent. Thanks!
<br><br>
</aspanel>
<br><br><br><br>
</form>
</body>
</html>
My question is, if my code sends this email and the email is
undeliverable. How can I notify myself of this information?
Thanks,
RABMissouri2006