By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,354 Members | 1,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,354 IT Pros & Developers. It's quick & easy.

sending an email...

P: n/a
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 = "an****@yahoo.com"
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 = "so*****@someaddress.com"

'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" />

<asp:panel id="panelMailSent" runat="server" Visible="False">
An email has been sent. Thanks!
<br><br>

</asp:panel>
<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

Dec 19 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
re:
My question is, if my code sends this email and the email is
undeliverable. How can I notify myself of this information?
You can't...and you don't need to.

The email server which receives the attempt to send the email
will send back a notification to whomever is in the objMM.From address.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"RAB" <ra*********@yahoo.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
>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 = "an****@yahoo.com"
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 = "so*****@someaddress.com"

'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" />

<asp:panel id="panelMailSent" runat="server" Visible="False">
An email has been sent. Thanks!
<br><br>

</asp:panel>
<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

Dec 19 '06 #2

P: n/a
"RAB" <ra*********@yahoo.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
My question is, if my code sends this email and the email is
undeliverable. How can I notify myself of this information?
The mail server will automatically notify the sender...
Dec 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.