473,466 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sending an email...

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
2 1848
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.