View Single Post
  #1 (permalink)  
Old March 31st, 2011, 12:00 PM
fredfenk fredfenk is offline
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
Reply With Quote