Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 31st, 2011, 12:00 PM
Registered User
Join Date: Mar 2011
Location: Ellenton, Fl
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Try it out on page 319

I have been trying to do the "Try it out" on page 319 for the last couple of days. I have been unsuccessful in everything that I have tried. I installed SP 1 in VS 2010 that I am using and it still does not work. Here is the web.config code that I am using.

<pages theme="Monochrome">
<add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx"/>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
<smtp deliveryMethod="SpecifiedPickupDirectory" from ="info@PlanetWrox.com">
<specifiedPickupDirectory pickupDirectoryLocation="c:\maildrop\"/>
<!--<smtp deliveryMethod="Network" from="Fred Fenk &lt;fwfenk3@gmail.com&gt;">
<network host="smtp.gmail.com" userName="fwfenk3@gmail.com" password="juliana0603"/>-->


As you can see that I have tried both of the methods that you recommended.
Below is the vb code behind the Email.aspx that you instructed for us to code in the vb code.

Dim myMessage As MailMessage = New MailMessage()
myMessage.Subject = "test message"
myMessage.Body = "Hello World, from Planet Wrox"
myMessage.From = New MailAddress("fwfenk3@gmail.net", "Fred Fenk")
myMessage.To.Add(New MailAddress("fwfenk3@gmail.net", "Fred Fenk"))

Dim mySmtpClient As SmtpClient = New SmtpClient()

It just will not send the message. That is the error that I am getting. I am at a loss because I cannot do the next "Try it out" or anything in chapter 10 until I get this resolved.

I have tried the SpecifiedPickupDirectory and it does not work. The error keeps on pointing to the "mySmtpclient.Send(myMessage)" line of code in my VB code. I have looked on the internet for other suggestions and they talk about schemas that need to be included in the code. But if I try to just write to my c drive why would I need schemas. I cannot even write to my c drive.

Please advise, I really need help.

Fred Fenk
Reply With Quote
  #2 (permalink)  
Old March 31st, 2011, 12:13 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi Fred,

But if I try to just write to my c drive why would I need schemas. I cannot even write to my c drive.
You don't need schemas to make this work. However, you do need to create the folder c:\maildrop up front as explained in the book. Can you confirm the folder exists?

If I create that folder and then use your code as-is, I get a message in the maildrop folder.

For Gmail, you also need to specify a portnumber. Something like this will probably work:

<network enableSsl="true" host="smtp.gmail.com" password="YourPassword"
userName="YourAccountName@gmail.com" port="587" />

If it still doesn't work, make sure you don't have Anti Virus software or other software blocking the outgoing mail.

If you still can't make it work, please post the error message you're seeing.



BTW: you may want to remove your Gmail password in the post, and change the From address in your web.config so I don't have to deal with your bounce messages.... ;-)
Imar Spaanjaars
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!
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 - Try It OUT on page 319 Windblown BOOK: Beginning ASP.NET 4 : in C# and VB 6 January 29th, 2011 10:23 AM
Page 210:Page object calling a private method from BasePage? aperture8 BOOK: Beginning ASP.NET 4 : in C# and VB 6 August 9th, 2010 07:04 AM
can’t open the page because the server where this page is located isn’t responding m_alsobaai Forum and Wrox.com Feedback 3 July 15th, 2010 06:13 AM
How to print a web page without title, URL, page #, date and time Mattt C# 2 July 17th, 2009 03:02 AM
Page 319: Exercise 1 kiwibrit BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 July 3rd, 2009 10:46 AM

All times are GMT -4. The time now is 05:45 AM.

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