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 2nd, 2010, 03:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

By defualt the control sends its own e-mail. Right before it does that, it raises the SendingMail event which your code can handle. In this case, inside this event you sent your own e-mail. To stop the framework from sending its own e-mail as well, you need to tell it not to do that by setting e.Cancel to true, Internally, something like this happens (pseudo code, not the real thing and does not compile).

Code:
 
Dim args As MailMessageEventArgs = New MailMessageEventArgs()
RaiseEvent SendingMail (args) ' this is where your event handler code is called
If Not args.Cancel Then
  ' Not cancelled, send e-mail here.
Else
  Apparently, someone subscribed to Sending mail set Cancel to True, so don't bother sending an e-mail.
End If
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
listing 15-15 pg(568) DyerOppenheimer BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 February 13th, 2008 01:41 PM
return *this - Chap 8 pg 418 proslambano BOOK: Ivor Horton's Beginning Visual C++ 2005 0 March 10th, 2007 01:19 PM
chap 15 manal_sag BOOK: Beginning ASP 3.0 2 July 10th, 2005 03:29 AM
help in chap 15 manal_sag BOOK: Beginning ASP 3.0 2 May 25th, 2005 02:59 AM
Sessions - Chap 15 mminnie BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 1 January 10th, 2005 04:25 AM





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