SmtpClient.Send() only sends after I quit my appl ?

G

Guy

I use the following code send mail in my C# application. It works, but
it does not send mail immediatly. If I quit my application, then the
mail gets send. I can see Norton scan my mail ..etc. What do I need to
do so that tye mail gets send right away, before I quit my program ?

Thanks.

SmtpClient smtp = new SmtpClient();
smtp.Host = "relais.videotron.ca";
smtp.Send("(e-mail address removed)", "(e-mail address removed)", "subject", "body");
 
J

Jesse Houwing

* Guy wrote, On 20-5-2007 23:16:
I use the following code send mail in my C# application. It works, but
it does not send mail immediatly. If I quit my application, then the
mail gets send. I can see Norton scan my mail ..etc. What do I need to
do so that tye mail gets send right away, before I quit my program ?

Thanks.

SmtpClient smtp = new SmtpClient();
smtp.Host = "relais.videotron.ca";
smtp.Send("(e-mail address removed)", "(e-mail address removed)", "subject", "body");

It should send directly. My guess is that it is a compatibility issue
with Norton. Which version of Norton Anti Virus are you using?

Jesse
 
N

neil.kilbride

Sounds strange to me, like it doesn't send the message until something
has been cleaned up by the garbage collector. Perhaps try creating a
MailMessage object to send the message and dispose of that object
after the send? Use the using( MailMessage message = new
Mailmessage( ... ) ) { } will do that for you. If that doesn't work,
try to enable tracing to see what is going on.

Good luck!
 
G

Guy

I tried de-activating Norton AV, v9.05.15. Same result. I tried the
"using() {}" construct. Same result.
I went into Outlook and configured it to "send/receive" every minute.
After a couple of minutes, the mail goes out, without having to quit
my program.

So, its being queued by Outlook, and not being sent right away.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top