Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 April 14th, 2010, 07:00 AM
Registered User
 
Join Date: Mar 2010
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Arrow SendingMail event is not functioning accurately?

Hi.Thank you Imar for your response.

Well,actually I have followed the instruction on this link

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=505

However,when the first time I put the code below :

Code:
Dim SmtpClient As mySmtpClient = New SmtpClient()
        mySmtpClient.EnableSsl = True
        mySmtpClient.Send(e.Message)
        e.Cancel = True
inside SendingMail event, the code seems have a few errors stated under
mySmtpClient instance. Then after I have try a few times to fix it, I closed my VWD, and restart back...and everything is functioning.
I can send email from SignUp.aspx page and also from ContactUs,aspx. I feel so relief after its working so fine.

But not until a few second after I stopped debugging my website, the code inside the SendingMail events which is the code that I stated above is missing.

And I try to insert back the code.Still, the same error is repeating. The mySmtpClient is in error and I can't debug my website to test the SignUp.aspx page again

Anything you would like to suggest?I appreciate your kindness...
 
Old April 14th, 2010, 08:15 AM
Registered User
 
Join Date: Mar 2010
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Exclamation mySmtpCliet is not defined,declared?

Below is the error from the code I stated before..

Code:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: BC30002: Type 'mySmtpClient' is not defined.

Source Error:

 

Line 4:  
Line 5:      Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail
Line 6:          Dim SmtpClient As mySmtpClient = New SmtpClient()
Line 7:          mySmtpClient.EnableSsl = True
Line 8:          mySmtpClient.Send(e.Message)
Why I have error with mySmtpCliet?

Below is the error:
Error 1 Type 'mySmtpClient' is not defined.
Error 2 Name 'mySmtpClient' is not declared.


I don't know whether this is specific enough or not...but this is the error I get from the code.
 
Old April 14th, 2010, 08:24 AM
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 mixing up variable names and type names. This is not correct:

Dim SmtpClient As mySmtpClient = New SmtpClient()

The syntax is:

Dim variableName As TypeName = New TypeName()

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
SendingMail event is not functioning accurately? dyla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 April 14th, 2010 07:28 AM
Chapter 15: SendingMail Event areed24 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 10 February 22nd, 2009 03:36 PM
Accurately Count Elements interrupt Javascript How-To 0 June 13th, 2005 02:21 AM





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