e-mail

Hobbes

Active member
Joined
May 22, 2003
Messages
37
I dont understand why the following code does not work

Could someone enlighten me please!


Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
mailMessage.From = "mymail@yahoo.com"
mailMessage.To = "mymail@yahoo.com"
mailMessage.Subject = "Email Subject"
mailMessage.Body = strMessage
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text

TODO: Set the mailMessage.Body property

System.Web.Mail.SmtpMail.SmtpServer = "colinlee.europe.webmatrixhosting.net"
System.Web.Mail.SmtpMail.Send(mailMessage)

:confused:
 
What actually happens when you try this, do you get any errors and if so which line. Or does it appear to work and no e-mail arrives?
 
Oops....

here it is ....

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.Runtime.InteropServices.COMException: The transport failed to connect to the server.

Thanks :)
 
Instead of this ...

System.Web.Mail.SmtpMail.SmtpServer = "colinlee.europe.webmatrixhosting.net"
System.Web.Mail.SmtpMail.Send(mailMessage)


I use the following...

SmtpMail.Send(mailMessage)

I found out from my hosting site at

europe.webmatrixhosting.net

go to their questions and answer. They have some helpful hints too
 


Write your reply...
Back
Top