473,395 Members | 1,639 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.

Delayed mail sending.

Hi,

I am trying to send an email in .Net 2 using the
System.Net.Mail.MailMessage class. I am using the code below:


if (_FromName.Length > 0)
Msg.From = new MailAddress(_FromAddress, _FromName);
else
Msg.From = new MailAddress(_FromAddress);

Msg.IsBodyHtml = _HTMLMessage;
Msg.Priority = _Priority;
Msg.Sender = Msg.From;
Msg.DeliveryNotificationOptions =
DeliveryNotificationOptions.None;

//Add the Credentials
SmtpClient client = new SmtpClient();
if (_Authenticate)
{ client.Credentials = new
System.Net.NetworkCredential(_UserName, _Password);
} else
client.UseDefaultCredentials = true;

client.Port = _Port;
client.Host = _ServerName;
client.EnableSsl = _EncryptedConnection;
client.DeliveryMethod = _DeliveryMethod;
if (_DeliveryMethod ==
SmtpDeliveryMethod.SpecifiedPickupDirectory)
client.PickupDirectoryLocation = _PickupDirectory;

if (Asynchronous)
{ client.SendCompleted += new
SendCompletedEventHandler(client_SendCompleted);
client.SendAsync(Msg, (object)Msg);
} else
{
client.Send(Msg);
}
<

Whether I try sending the message synchronously or Asynchronously, the
message does not get sent. If I send a second message, then the first
one is sent. The final message is only sent when I close down the
application.
client.DeliveryMethod is being set to SmtpDeliveryMethod.Network.
Does anybody know what the problem is?
Thankyou
Paul


Jun 23 '06 #1
0 1058

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

Similar topics

0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
0
by: Fabrice DG | last post by:
Hi all. I don't know if this post is really at the right place but I hope someone can help me.. I developed a NT service, in order to automate mail exchanges between different kind of users This...
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...
2
by: HK | last post by:
In VB.NET, I'm getting the exception "failure sending mail". I'm running VS 2005 on XP Home. This is a new install on a new PC. I've never had email problems with VS 2003, and there I could...
3
by: mfleet1973 | last post by:
Hello Again. I have a program that sends e-mails as follows: Try Dim mail As New MailMessage mail.To = "me@comp.com" mail.From = "me@comp.com mail.Subject = "Test" mail.Body = "Testing123"
5
by: Jim in Arizona | last post by:
I realize that by design, web client/server interaction is disconnected. I'm wondering if there is a way that when a client/server interaction occurs, if there is a way to start a time on the web...
4
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
I have a web page that at the click of a button must send a bunch (1000+) emails. Each email is sent individually. I have the code working fine, using Mail Message classes and smtp and all that. ...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.