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 March 14th, 2010, 03:23 PM
Banned
 
Join Date: Jan 2010
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default Chapter 9 Can't send email

I've tried various ways to send and email on page 309 but am still having a problem. I get the following message:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 65.55.172.254:25.
Any help is appreciated.

Chuck

Source Error:

Line 13: Dim mySmtpClient As SmtpClient = New SmtpClient()
Line 14: mySmtpClient.EnableSsl = True
Line 15: mySmtpClient.Send(myMessage)
Line 16: End Sub
Line 17: End Class

Here's my code for the webconfig. I got some of it off a site I googled that showed how to set it up ASP.net with hotmail:

<system.net>
<mailSettings>
<smtp from="[email protected]"> <network host="smtp.live.com"
defaultCredentials="false" port="25" userName ="chuck8556 @hotmail.com" password="xxxxxx" />
</smtp>
</mailSettings>
</system.net>
[/code]

Here's the code behind:


Code:
Imports System.Net.Mail
Partial Class Email
  Inherits BasePage


  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim myMessage As MailMessage = New MailMessage()
    myMessage.Subject = "Test Message"
    myMessage.Body = "Hello world, from Planet Wrox"
    myMessage.From = New MailAddress("[email protected]", "Sender Name Here")
    myMessage.To.Add(New MailAddress("[email protected]", "Receiver Name Here"))

    Dim mySmtpClient As SmtpClient = New SmtpClient()
    mySmtpClient.EnableSsl = True
    mySmtpClient.Send(myMessage)
  End Sub
End Class
 
Old March 14th, 2010, 06:02 PM
Friend of Wrox
 
Join Date: Dec 2008
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

You need to use port 587 for smtp.live.com. Good luck!
The Following User Says Thank You to PeterPeiGuo For This Useful Post:
ChuckASP (March 14th, 2010)
 
Old March 14th, 2010, 08:35 PM
Banned
 
Join Date: Jan 2010
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Thanks. That did the trick.

Chuck
 
Old April 22nd, 2010, 12:16 PM
Registered User
 
Join Date: Apr 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default same problem with sending email. - chapter 9 - pg 311

thank you,
this helped me too.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 Trying to send email out digink BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 March 5th, 2011 05:42 AM
send email phuc2583 ASP.NET 2.0 Professional 2 April 14th, 2009 10:07 AM
How to send email abiye49 Excel VBA 1 January 10th, 2007 03:32 PM
To send an email Danny_n BOOK: Excel 2003 VBA Programmer's Reference 0 January 12th, 2005 08:33 AM
Send email Danny_n BOOK: Excel 2003 VBA Programmer's Reference 0 January 12th, 2005 08:32 AM





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