Wrox Programmer Forums
| 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 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 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.

<configuration>
<system.web>
<pages theme="Monochrome">
<controls>
<add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx"/>
</controls>
</pages>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
</system.web>
<system.net>
<mailSettings>
<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"/>-->
</smtp>

</mailSettings>
</system.net>
</configuration>

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()
mySmtpClient.Send(myMessage)

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
 
Old March 31st, 2011, 12:13 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Fred,

Quote:
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.

Cheers,

Imar

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
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
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





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