p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Basics (http://p2p.wrox.com/forumdisplay.php?f=351)
-   -   Creating E-Mail Messages (http://p2p.wrox.com/showthread.php?t=71196)

janla2112 October 26th, 2008 10:47 AM

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;xxxxxxx@yahoo.com.Com&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("xxxxxx@yahoo.com", "Jan Lawrence")
    myMessage.To.Add(New MailAddress("xxxxxx@yahoo.com", "Jan Lawrence"))

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



Jan

Imar October 26th, 2008 11:10 AM

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.

janla2112 October 26th, 2008 12:39 PM

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

Imar October 26th, 2008 01:23 PM

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.


All times are GMT -4. The time now is 01:35 PM.

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