Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > sending an email...

Reply
Thread Tools

sending an email...

 
 
RAB
Guest
Posts: n/a
 
      12-19-2006
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 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 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

 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      12-19-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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 = "(E-Mail 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 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
>



 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      12-19-2006
"RAB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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...


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem sending mail: Sending the email to the following server failed Luke Java 2 03-15-2007 10:54 AM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM
sending messages JLunis Wireless Networking 5 03-30-2005 08:34 PM
Sending Messages over wireless network =?Utf-8?B?R2lic29ubg==?= Wireless Networking 0 08-19-2004 03:09 AM
Sending text messages to cell phones.. VM Wireless Networking 4 06-26-2004 04:57 PM



Advertisments