G
Guest
This box sends email all the time with a localhost smtp address on .NET 1.1
code framework, fails with the 2.0 API. Any thoughts?
Exception:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at csxlib.SmtpMessage.TestSend() in F:\Projects\Visual Studio 2005\csxlib
v 0.9.7\SmtpMessage.vb:line 124
at Mail_Test.Module1.Main() in F:\Projects\Visual Studio 2005\Mail
Test\Mail Test\Mail Test\Module1.vb:line 9
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()"
Here is the code:
Public Sub TestSend()
Dim client As SmtpClient = New SmtpClient("localhost")
Dim froom As MailAddress = New MailAddress("(e-mail address removed)", "c",
System.Text.Encoding.UTF8)
' Set destinations for the e-mail message.
Dim too As MailAddress = New MailAddress("(e-mail address removed)")
' Specify the message content.
Dim message As MailMessage = New MailMessage(froom, too)
message.Body = "This is a test e-mail message sent by an
application. "
' Include some non-ASCII characters in body and subject.
message.Body += Environment.NewLine + ">>>>>>>>>>>>>>>>>>>"
message.BodyEncoding = System.Text.Encoding.UTF8
message.Subject = "test message 1" + "<<<<<<<<<<<<<<<<"
message.SubjectEncoding = System.Text.Encoding.UTF8
client.Send(message)
message.Dispose()
End Sub
code framework, fails with the 2.0 API. Any thoughts?
Exception:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at csxlib.SmtpMessage.TestSend() in F:\Projects\Visual Studio 2005\csxlib
v 0.9.7\SmtpMessage.vb:line 124
at Mail_Test.Module1.Main() in F:\Projects\Visual Studio 2005\Mail
Test\Mail Test\Mail Test\Module1.vb:line 9
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()"
Here is the code:
Public Sub TestSend()
Dim client As SmtpClient = New SmtpClient("localhost")
Dim froom As MailAddress = New MailAddress("(e-mail address removed)", "c",
System.Text.Encoding.UTF8)
' Set destinations for the e-mail message.
Dim too As MailAddress = New MailAddress("(e-mail address removed)")
' Specify the message content.
Dim message As MailMessage = New MailMessage(froom, too)
message.Body = "This is a test e-mail message sent by an
application. "
' Include some non-ASCII characters in body and subject.
message.Body += Environment.NewLine + ">>>>>>>>>>>>>>>>>>>"
message.BodyEncoding = System.Text.Encoding.UTF8
message.Subject = "test message 1" + "<<<<<<<<<<<<<<<<"
message.SubjectEncoding = System.Text.Encoding.UTF8
client.Send(message)
message.Dispose()
End Sub