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 <
[email protected]>">
<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