ASP.NET - Any ideas why I can't send email from my code?
Posted on 2006-11-14
I found and changed the following code:
Dim strfrom As String = "email@example.com"
Dim strto As String = "firstname.lastname@example.org"
Dim emailsub As String = "a subject"
Dim bod As String
bod = "body text"
Dim mysmtpclient As New System.Net.Mail.SmtpClient("MyExchangeServer.MyCompaniesDomain.plc.uk")
mysmtpclient.Send(strfrom, strto, emailsub, bod)
I am using visual web developer 2005 express using VB.
I get an error on the last line saying smtpexception was unhandled by user code.
I should also mention I have put the library Imports system.net.mail at the top of the page and am running this from a command button
I am using this on my client machine using VB's own web server while connected to my corporate network
Any help would be brill !