470,862 Members | 1,708 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,862 developers. It's quick & easy.

Slow system.net.mail performance?

I've made small class to sent email using the system.net.mail namespace and
it is really slow. any ideas why i'm having such a performance hit?

it seems to work much better when i don't use authentication, however, it's
very slow when i do use it.

Imports Microsoft.VisualBasic
Imports System.Net
Imports System.Net.Mail

Public Class emailhelper
Sub sendmail(ByVal emailto As String, ByVal emailfrom As String, ByVal
emailfromname As String, ByVal body As String, ByVal subject As String)
Dim Msg As MailMessage = New MailMessage()
Dim MailObj As New
SmtpClient(ConfigurationManager.AppSettings("SmtpS erver"))
MailObj.UseDefaultCredentials = False
MailObj.Credentials = New
Net.NetworkCredential("em*********@test.com", "password")
MailObj.DeliveryMethod = SmtpDeliveryMethod.Network

Msg.From = New MailAddress(emailfrom, emailfromname)
Msg.To.Add(New MailAddress(emailto))
Msg.IsBodyHtml = "True"
Msg.Body = body
Msg.Subject = subject

End Sub
End Class
Apr 9 '06 #1
0 1337

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Kurt Bauer | last post: by
8 posts views Thread by BlueBall | last post: by
52 posts views Thread by frankgerlach | last post: by
4 posts views Thread by =?Utf-8?B?dHBhcmtzNjk=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.