PC Review


Reply
Thread Tools Rate Thread

Delayed mail sending.

 
 
Paul Cheetham
Guest
Posts: n/a
 
      23rd Jun 2006
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




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending delayed mail Harold Raphael Microsoft Outlook Installation 3 12th Jun 2008 11:55 PM
Sending Delayed E-mail coolblueshot@gmail.com Microsoft Outlook 3 29th Jul 2006 08:41 PM
Sending a delayed e-mail message when I'm logged out of Outlook =?Utf-8?B?Q29ubmllQg==?= Microsoft Outlook Discussion 1 10th Mar 2006 11:38 PM
When Delayed Sending Mail Item what is the True Creation Date =?Utf-8?B?RGF2aWQgTW9uYXN0?= Microsoft Outlook Discussion 3 26th Jan 2006 08:48 PM
Sending e-mail w/ delayed send in Outlook 2003 cached mode =?Utf-8?B?UGFwRmlu?= Microsoft Outlook Discussion 0 14th Jun 2005 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 AM.