Solved

System.Net.Mail Performance Problem

Posted on 2006-11-03
4
296 Views
Last Modified: 2012-06-27
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
Comment
Question by:ctudorprice
  • 2
  • 2
4 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 17868274
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
 

Author Comment

by:ctudorprice
ID: 17868676
process the "send" for 40 seconds on the webserver - I have tracing and timing.
0
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
ID: 17868686
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
 

Author Comment

by:ctudorprice
ID: 17870046
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Achieve json result 2 64
Search by two fields at the same time using c# radio button 5 39
Name space syntax error 12 39
Host asp.net pages 5 25
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now