Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

System.Net.Mail.SmtpClient.Send Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
george - 12 Jun 2006 15:53 GMT
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("c@d.com", "c",
System.Text.Encoding.UTF8)
       ' Set destinations for the e-mail message.
       Dim too As MailAddress = New MailAddress("a@b.com")
       ' 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
sloan - 12 Jun 2006 15:59 GMT
I have a complete 1.1 and 2.0 email send code you can download at:

http://spaces.msn.com/sholliday/
2/8/2006 entry

The syntax of 2.0 is definately different.

Please post (here) if you figure out what it was.

> 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?
[quoted text clipped - 38 lines]
>
>     End Sub

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.