• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

System.Net.Mail Performance Problem

Hi - I use the following to send emails from my site. Problem is that the send takes 40 secs but is successful! Anyone have any idea why?
The SMTP service is local on the IIS webserver and suffers from no other performance issues.

Dim MM As New System.Net.Mail.MailMessage(New Net.Mail.MailAddress(FromAddress), New Net.Mail.MailAddress(ToAddress))
MM.Subject = mailsubject
MM.Body = Message
MM.IsBodyHtml = False
Dim smtp As New System.Net.Mail.SmtpClient(System.Configuration.ConfigurationManager.AppSettings("MailServer"))
smtp.Credentials = New System.Net.NetworkCredential(System.Configuration.ConfigurationManager.AppSettings("SMTPUser"), System.Configuration.ConfigurationManager.AppSettings("SMTPPswd"))
smtp.Send(MM) 'this line TAKES 40 SECONDS!

THANKS
0
ctudorprice
Asked:
ctudorprice
  • 2
  • 2
1 Solution
 
strickddCommented:
does it process for 40 seconds or does the mail take 40 seconds to be received? If it takes 40 seconds to send then I would check your anti-virus and see if it is scanning the smtp mail and if it is blocking port 25. You may also need to check if the router is blocking port 25. If it takes 40 seconds to be received, that isn't anything you can really take care of.
0
 
ctudorpriceAuthor Commented:
process the "send" for 40 seconds on the webserver - I have tracing and timing.
0
 
strickddCommented:
I would try disabling your antivirus for one test. Also you should check and make sure the SMTP Port (port 25) doesn't have any blocks...
0
 
ctudorpriceAuthor Commented:
Hi - it was actually the mail server's Sender Policy Framework (SPF) check that was causing the massive delay... disabled it and mail works fine.
Thanks for the advice strickdd.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now