Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 26th, 2007, 05:03 AM
Registered User
 
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar
 My send() method is working and I can send whatever message I want to send to my user. But using send()method, how can I pass the following info to the user's email so that my user can click on the link(highlighted) and my database will authenticate him as a genuine user and allow him to move on.
 This code you have already given but how is it possible to incorporate into send() method to send the following info to user ?



Welcome to the Appointment Booking System,

Before you can use the application, you'll need to confirm the existence of your email address.
To do this, click the following link:
http://localhost:1837/AppointmentBoo...9-3b1f95fce4d2

Right after you confirmed your address, your account will be activated and you can start booking apppointments.

Kind regards,

The Appointment Team




I think I am now quite specific to the problem. Please bear with me.
I am very new in this field.

Thanks and regards

Ajoy

 
Old August 26th, 2007, 05:14 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Isn't that exactly what my previous message describes??

1. Read in mail body using System.IO.File
This way, you get the mail body from the file called OptInEmail.html that already contains the relevant placeholders. For example:
Code:
Dim filePath As String = Server.MapPath("~/StaticFiles/OptInEmail.html")
Dim mailBody As String = System.IO.File.ReadAllText(filePath)
2. Replace values in body using Replace
Page 340 and 341 describe this in full detail.

3. Create a new MailMessage object and assign To, From, Subject and Body properties
Page 198 and onwards describe this in full detail.

4. Send the MailMessage using the Send method of the SmtpClient.
Again, this is shown on page 198 and onwards.

What exactly is not clear about this list? For what parts fo you need help?

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old August 26th, 2007, 06:09 AM
Registered User
 
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,
I am repeatedly telling that I am new in this field. Really, I could not guess so much from your previous brief hints due to my lack of knowledge and for that I am extreamely sorry. Your next explanation has definitely cast some light on my further approach. Thanks a lot for your effort. Let me give some time to read and grasp the whole idea and implement it according to your valuable suggestion. Hope it will definitely work. I will be in touch with you shortly.

Thanks .

(This is also my very first entry into a forum)

So please bear with me.

Thanks again.
Regards.

Ajoy



 
Old August 26th, 2007, 07:38 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No problem; I completely understand that. That's why I also added references to page numbers so you know where to look for more information.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old August 26th, 2007, 02:00 PM
Registered User
 
Join Date: Aug 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes !!! I got it. Thank you very very much Imar !!! What a relief !

Here is what I have done finally based on your fantastic guidance .

================================================== ===================

Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail
        e.Cancel = True

        Dim myfilePath As String = Server.MapPath("~/StaticFiles/OptInEmail.html")
        Dim mymailBody As String = System.IO.File.ReadAllText(myfilePath)
        Dim sc As New Net.Mail.SmtpClient()

        sc.EnableSsl = True

        mymailBody = mymailBody.Replace("##Id##", Membership.GetUser(CreateUserWizard1.UserName).Pro viderUserKey.ToString())
        mymailBody = mymailBody.Replace("##UserName##", CreateUserWizard1.UserName)

        Dim applicationFolder As String = Request.ServerVariables.Get("SCRIPT_NAME").Substri ng(0, Request.ServerVariables.Get("SCRIPT_NAME").LastInd exOf("/"))

        mymailBody = mymailBody.Replace("##FullRootUrl##", Helpers.GetCurrentServerRoot & applicationFolder)


        Dim mymailMsgobj As New Net.Mail.MailMessage("[email protected]", CreateUserWizard1.Email, "Registration Confirmation", mymailBody)

        mymailMsgobj.IsBodyHtml = True

        sc.Send(mymailMsgobj)

    End Sub

================================================== ===================


Thanks a lot for your great patience to tolerate me so long !

I can not express my gratitude in any other way. I will definitely seek help from you in this field in future.

Bye.

Ajoy.



 
Old August 26th, 2007, 02:22 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome. Glad you were able to figure it out on your own....

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
Captcha + E-mail with link verification ViagraFalls BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 13 September 24th, 2007 04:06 AM
logo link in the header & strange chars - mail luisjeronimo BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 26th, 2007 11:07 AM
Send mail failed using asp.net anujrathi ASP.NET 1.0 and 1.1 Professional 1 June 22nd, 2006 07:59 PM
how to send activation link with e mail spbharti PHP How-To 2 December 28th, 2005 09:17 AM
e-mail a link p2ptolu Classic ASP Databases 1 June 17th, 2005 06:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.