473,320 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

System.Net.Mail.SmtpClient is slower

Hi everyone,

I'm coverting some of our code here from the old way of send email in
..net 1.1 to the new .net 2.0. However, everyone I switch the code the
new method there is a delay of 1-2 minutes before an email is sent
(this is on my local computer point to my local smtp -> localhost).
Anyone knows what the problem could be? BTW my computer in located
behind a firewall and I'm sending test emails to my gmail account and
hotmail account. It seems like the new way always takes around 2
minutes to send the email.
============ Old way ==========
System.Web.Mail.MailMessage MyMail= new
System.Web.Mail.MailMessage();
MyMail.From = "te**@test.com";
MyMail.Subject = "Test";
MyMail.Body = body;
MyMail.BodyFormat = System.Web.Mail.MailFormat.Html;
System.Web.Mail.SmtpMail.SmtpServer = SmtpServer;
MyMail.To = "te**@test.com"
System.Web.Mail.SmtpMail.Send(MyMail);

============ New way ==========
System.Net.Mail.SmtpClient mail = new System.Net.Mail.SmtpClient();
mail.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
mail.UseDefaultCredentials = false;
mail.Host = SMTPServer;
string subject = "Test";
string body;
body = DateTime.Now + "\r\n";
body += comment;
MailAddress sender = new MailAddress(from);
MailMessage mailMessage = new MailMessage();
string[] recipients = to.Split(';');

mailMessage.From = sender;

// Add recipients separated by ;
foreach (string recipient in recipients)
{
mailMessage.To.Add(recipient);
}

mailMessage.Body = body;
mailMessage.Subject = subject;

mail.Send(mailMessage);

May 10 '06 #1
1 4144
think this might be down to your virus checker! - ours holds email for about
2 mins when sent with the new way, but allowes them to go through instantly
with the old one.
"ma*******@gmail.com" wrote:
Hi everyone,

I'm coverting some of our code here from the old way of send email in
..net 1.1 to the new .net 2.0. However, everyone I switch the code the
new method there is a delay of 1-2 minutes before an email is sent
(this is on my local computer point to my local smtp -localhost).
Anyone knows what the problem could be? BTW my computer in located
behind a firewall and I'm sending test emails to my gmail account and
hotmail account. It seems like the new way always takes around 2
minutes to send the email.
============ Old way ==========
System.Web.Mail.MailMessage MyMail= new
System.Web.Mail.MailMessage();
MyMail.From = "te**@test.com";
MyMail.Subject = "Test";
MyMail.Body = body;
MyMail.BodyFormat = System.Web.Mail.MailFormat.Html;
System.Web.Mail.SmtpMail.SmtpServer = SmtpServer;
MyMail.To = "te**@test.com"
System.Web.Mail.SmtpMail.Send(MyMail);

============ New way ==========
System.Net.Mail.SmtpClient mail = new System.Net.Mail.SmtpClient();
mail.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
mail.UseDefaultCredentials = false;
mail.Host = SMTPServer;
string subject = "Test";
string body;
body = DateTime.Now + "\r\n";
body += comment;
MailAddress sender = new MailAddress(from);
MailMessage mailMessage = new MailMessage();
string[] recipients = to.Split(';');

mailMessage.From = sender;

// Add recipients separated by ;
foreach (string recipient in recipients)
{
mailMessage.To.Add(recipient);
}

mailMessage.Body = body;
mailMessage.Subject = subject;

mail.Send(mailMessage);

Jul 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: alex | last post by:
hello, i am trying to use the System::Mail::Net library to have my application send some mail. i initialize all the necessary objects, such as MailAddress from and MailAddress to, and then a...
2
by: mazdotnet | last post by:
Hi everyone, I'm coverting some of our code here from the old way of sending mail in ..NET 1.1 to the new .NET 2.0. However, everytime I switch the code to the new method there is a delay of 1-2...
4
by: Brian Lorraine | last post by:
I tried out the new System.Net.Mail.SmtpClient feature of asp.net 2.0 and I love it, but there's just one problem. When it sends an email out, it sends to BOTH the TO and the FROM address. I have...
2
by: SR | last post by:
I have 2 controls that seem to conflict with each other. On my Master page I have a Menu control and on my Content page Panel control. The formatting is great, all fine and dandy, until I hover...
0
by: howardr101 | last post by:
Hi, Have hunted around on the groups and can't find anything, hence. I've tried this against 2 mail servers (mailtraq and hmailserver) and it occus with both. The problems seems to be that...
2
by: clevrmnkey | last post by:
I've had nothing but trouble from the System.Net.Mail objects, but I finally need to make them work, and I can't for the life of me see what I'm doing wrong. I pared back my mail transaction to...
1
by: les | last post by:
I'm getting this error "BC30456: 'IsBodyHtml' is not a member of 'System.Net.Mail.SmtpClient'" when trying to submit a form and send email. If I remove the line "MailObj.IsBodyHtml = True" the...
2
by: Claire | last post by:
I'm a noob at emailing from code and I need to add email capabilities to my application. The following code completes without exceptions but I'm not receiving any test emails. How do you debug...
1
by: Marco Shaw [MVP] | last post by:
http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.clientcertificates.aspx I'm having a hard time to find/understand how this property works. It only supports get, but how does...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.