Forcing a new SMT session

R

ronchese

Hello.

I'm using System.Net.Mail.SmtpClient class to send e-mails.

Actually, I'm breaking the recipients in lots of 10 emails for each e-mail I send, and sending it to a machine that has the SMTP program that delivers the messages.

For understanding how it is working, there is a little sample that I wrote for brevity:

'colEmails is a ArrayList collection of System.Net.Mail.MailMessage objects.
'this collection was done to set a maximum of 10 recipients for each email object.

'send all email objects
For i as Integer = 0 to colEmails.Count - 1
Dim objSmtp As New System.Net.Mail.SmtpClient
objSmtp.Send(colEmails.Item(i))
Next

'Note ==> I need to send each email object using a new SMTP session

But, we noticed in the SMTP program, all the e-mails were sent by one session only. I thought the code above would do that, once I'm starting a new SmtpClient object for each email object. But didn't.

My doubt is, we need to configure the SMTP program ou it could be done by code, so it start a new session automatically instead of staking in a existent one? And how we can do it?

Cesar
 
P

PlatinumBay

ronchese,

My first question out of curiosity, is why you need a new session?

This may be a question for a Microsoft engineer to determine whether this is
the default behavior.


Steve

"ronchese" <info(a)carsoftnet.com.br> wrote in message
Hello.

I'm using System.Net.Mail.SmtpClient class to send e-mails.

Actually, I'm breaking the recipients in lots of 10 emails for each e-mail I
send, and sending it to a machine that has the SMTP program that delivers
the messages.

For understanding how it is working, there is a little sample that I wrote
for brevity:

'colEmails is a ArrayList collection of System.Net.Mail.MailMessage
objects.
'this collection was done to set a maximum of 10 recipients for each email
object.

'send all email objects
For i as Integer = 0 to colEmails.Count - 1
Dim objSmtp As New System.Net.Mail.SmtpClient
objSmtp.Send(colEmails.Item(i))
Next

'Note ==> I need to send each email object using a new SMTP session

But, we noticed in the SMTP program, all the e-mails were sent by one
session only. I thought the code above would do that, once I'm starting a
new SmtpClient object for each email object. But didn't.

My doubt is, we need to configure the SMTP program ou it could be done by
code, so it start a new session automatically instead of staking in a
existent one? And how we can do it?

Cesar
 
R

ronchese

It's a customer request. If it is something not usual, I'm going to say
them, because I don't see anything really usefull on it, also.
;)
 

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