473,395 Members | 1,656 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,395 software developers and data experts.

ASP 2.0 Net.Mail.SmtpClient Delay

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 minutes before an email is sent
(this is on my local computer pointing 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);

Thank you
Maz

May 10 '06 #1
2 2597
I have used Net.Mail through my local smtp to my internal email and that
was immediate
No delays at all. Did not try sending to Hotmail or Gmail

SA

"mazdotnet" <ma*******@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
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 minutes before an email is sent
(this is on my local computer pointing 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);

Thank you
Maz

May 10 '06 #2
http://spaces.msn.com/sholliday/ 2/8/2006
Try sending your email to your gmail account .. THRU gmail smtp server.

I think your issue is hotmail and gmail. You probably need to test it
against a "normal" email address like
ji***@hometownisp.com

Check my blog, if you download the project, you can see how to send thru the
gmail smtp server .. in 1.1 and 2.0 (slightly different settings)

\

"mazdotnet" <ma*******@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
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 minutes before an email is sent
(this is on my local computer pointing 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);

Thank you
Maz

May 10 '06 #3

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

Similar topics

3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
3
by: dnuos | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Here's some details: ...
1
by: maflatoun | last post by:
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...
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...
4
by: shapper | last post by:
Hello, I am trying to send an email from a form in my web page. I have the following codes: ... Dim mailSettings As New System.Net.Configuration.MailSettingsSectionGroup Dim smtpClient As...
1
by: WIzmanG | last post by:
Hi all I am having trouble with sending email via a C#2.0 application, I use the same settings as I use in Outlook but I cannot get email to send. I am trying to use SSL on port 465 and get the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.