Wrox Programmer Forums
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics 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 October 26th, 2008, 10:47 AM
Registered User
 
Join Date: Oct 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to janla2112
Default Creating E-Mail Messages

HI,
I am trying to use my yahoo mail account to send and receive a message. I wasn't sure how to set this up...I tried enabling the ssl property. Also, the book mentions adding a username and password, but it wasn't clear on where to insert that. I will post the error message here. However, all it is saying is it is timing out and can't connect so I know it had something to do with the code.
I will also post my web.config and Code Behind for the Email file as well.

Thanks,
Jan


Server Error in '/' Application.
--------------------------------------------------------------------------------

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 69.147.102.58:25
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: 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 69.147.102.58:25

Source Error:


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


Source File: C:\BegASPNET\Site\Demos\Email.aspx.vb Line: 14
__________________________________________________ _______________
Web.config file:

<system.net>
    <mailSettings>
     <smtp deliveryMethod="Network" from="Jan Lawrence &lt;[email protected]&gt;">
        <network host="smtp.mail.yahoo.com"/>
     </smtp>
    </mailSettings>
</system.net>
__________________________________________________ _________________

Email file:

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]", "Jan Lawrence")
    myMessage.To.Add(New MailAddress("[email protected]", "Jan Lawrence"))

    Dim mySmtpClient As SmtpClient = New SmtpClient()
    mySmtpClient.EnableSsl = True
    mySmtpClient.Send(myMessage)
End Sub
End Class



Jan
 
Old October 26th, 2008, 11:10 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Jan,

A couple of things...

First of all, can you please post book related messages in its own forum located here: http://p2p.wrox.com/forum.asp?FORUM_ID=386
That way, I won't overlook them, and other readers will find it easier to find answers to questions they may have,

Secondly, configuring security for your mail server is discussed on page 308 and onwards. You'll see how to add the user name and password in the web.config file.

Finally, are you sure Yahoo allows you to use their mail server like this?

BTW: you may want to edit your message and get rid of your e-mail addresses.

Hope this helps,

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old October 26th, 2008, 12:39 PM
Registered User
 
Join Date: Oct 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to janla2112
Default

HI Imar,
Thanks for the heads up on the e-mail. Bonehead mistake. That was I wasn't sure about. Do you know if sbcglobal allows you to do it either as I think they were swallowed by yahoo as well. Otherwise, I am dead in the water.

Thanks,
Jan

Jan
 
Old October 26th, 2008, 01:23 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't know as I don't know sbcglobal.

But they'll probably have FAQs or a helpdesk that can answer this?

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
Send messages to users not using e-mail Clayton_Couto General .NET 0 July 19th, 2006 07:23 AM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





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