send email question

M

Mike

I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
I

IfThenElse

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
M

Mike

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
S

sloan

Then you gotta loop and send them seperately.


If you get my downloadable example code at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

I have the routine better encapsulated, so sending emails one by one would be a little cleaner.



But you want this:

void SendThem()
{

String[] temp = TextBox1.Text.ToString().Split(';');
foreach (string EmailAddress in temp)
{

//be nice to add this
if( IsValidEmail ( SendTheEmail ) /// you gotta write this function, but it would be better than sending emails to bad addresses
{

SendTheEmail( EmailAddress );

}

}
}
}

void SendTheEmail( string to )
{
//Code Here // See my blog entry
}

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
M

Mike

thats what i have and its still sending 1 email with all email addresses in the [to] section


Then you gotta loop and send them seperately.


If you get my downloadable example code at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

I have the routine better encapsulated, so sending emails one by one would be a little cleaner.



But you want this:

void SendThem()
{

String[] temp = TextBox1.Text.ToString().Split(';');
foreach (string EmailAddress in temp)
{

//be nice to add this
if( IsValidEmail ( SendTheEmail ) /// you gotta write this function, but it would be better than sending emails to bad addresses
{

SendTheEmail( EmailAddress );

}

}
}
}

void SendTheEmail( string to )
{
//Code Here // See my blog entry
}

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
S

sloan

Are you using my code example? And its not working?
Or are you using a modified version of your code, and its not working?


I think your issue is this:
message.To.Add(new MailAddress(EmailAddress ));

You are just adding emails to the list.


I will suggest again, to get my sample code, and call my send mail routine, which freshly instantiates all objects.



thats what i have and its still sending 1 email with all email addresses in the [to] section


Then you gotta loop and send them seperately.


If you get my downloadable example code at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

I have the routine better encapsulated, so sending emails one by one would be a little cleaner.



But you want this:

void SendThem()
{

String[] temp = TextBox1.Text.ToString().Split(';');
foreach (string EmailAddress in temp)
{

//be nice to add this
if( IsValidEmail ( SendTheEmail ) /// you gotta write this function, but it would be better than sending emails to bad addresses
{

SendTheEmail( EmailAddress );

}

}
}
}

void SendTheEmail( string to )
{
//Code Here // See my blog entry
}

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
M

Mike

I have my own send mail routine that I'm using, I can't find no code example on the url you provided

Are you using my code example? And its not working?
Or are you using a modified version of your code, and its not working?


I think your issue is this:
message.To.Add(new MailAddress(EmailAddress ));

You are just adding emails to the list.


I will suggest again, to get my sample code, and call my send mail routine, which freshly instantiates all objects.



thats what i have and its still sending 1 email with all email addresses in the [to] section


Then you gotta loop and send them seperately.


If you get my downloadable example code at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

I have the routine better encapsulated, so sending emails one by one would be a little cleaner.



But you want this:

void SendThem()
{

String[] temp = TextBox1.Text.ToString().Split(';');
foreach (string EmailAddress in temp)
{

//be nice to add this
if( IsValidEmail ( SendTheEmail ) /// you gotta write this function, but it would be better than sending emails to bad addresses
{

SendTheEmail( EmailAddress );

}

}
}
}

void SendTheEmail( string to )
{
//Code Here // See my blog entry
}

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
S

sloan

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry


About 3/4's of the way down.

You'll see the following line:

You can download the code HERE. (Right-Click and "Save As" works best)







I have my own send mail routine that I'm using, I can't find no code example on the url you provided

Are you using my code example? And its not working?
Or are you using a modified version of your code, and its not working?


I think your issue is this:
message.To.Add(new MailAddress(EmailAddress ));

You are just adding emails to the list.


I will suggest again, to get my sample code, and call my send mail routine, which freshly instantiates all objects.



thats what i have and its still sending 1 email with all email addresses in the [to] section


Then you gotta loop and send them seperately.


If you get my downloadable example code at:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

I have the routine better encapsulated, so sending emails one by one would be a little cleaner.



But you want this:

void SendThem()
{

String[] temp = TextBox1.Text.ToString().Split(';');
foreach (string EmailAddress in temp)
{

//be nice to add this
if( IsValidEmail ( SendTheEmail ) /// you gotta write this function, but it would be better than sending emails to bad addresses
{

SendTheEmail( EmailAddress );

}

}
}
}

void SendTheEmail( string to )
{
//Code Here // See my blog entry
}

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
I

IfThenElse

BCC will still send personalized.

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 
M

Mike

but they won't see (e-mail address removed) in the To: section of the email when they get it and thats what I want.
Multiple emails to 1 or more people but each person sees their email address and only their address in the[To:] section of the email
BCC will still send personalized.

we want to make a little "personal" so the person sees their name in the TO instead of nothing or everyone.

how would the one by one work? If they enter in 5 in the textbox, how can I fire off one email at a time without having the user enter in 1 address, click send, then enter in another one - click send and so on?

You can send one by one OR

You can put only one email address in the To and the reset in the BCC


I have a page with a textbox that a user can enter in mutliple email addresses such as:

(e-mail address removed);[email protected];[email protected];

and so on, I then have a foreach loop to get all of the emaill addresses and send emails out.

the problem is that all of the email addresses the email is being sent to is showing in the [TO] section so everyone knows who's getting the email.

How can I have 1 email address showing in the [TO] section so no one knows who else is getting the email?

this is what I have;

SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage();
smtp.Host = ConfigurationManager.AppSettings["smtpServer"];
message.From = new MailAddress(ConfigurationManager.AppSettings["FromAddress"]);

String[] temp = TextBox1.Text.ToString().Split(';');

foreach (string EmailAddress in temp)
{
message.To.Add(new MailAddress(EmailAddress ));
message.Subject = "a subject will go here;
message.Body = stuff will go here";
smtp.Send(message);
}

I don't want the people that get this email see who else gets it. And a group is not possible due to the address can change
 

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

Similar Threads


Members online

Forum statistics

Threads
473,836
Messages
2,569,750
Members
45,545
Latest member
rapter____0

Latest Threads

Top