Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi;
I am doing online shopping site.In this site i have email news subscription form.
In admin side, admin can select multiple emails from grid and send with msg and content. I want to send content with news subscription deactivation code.

In my form i use following code

protected void dlContactus_ItemCommand(object source, DataListCommandEventArgs e)
{
blErr.Items.Clear();

switch (e.CommandName)
{

case "SEND":
CheckBox chk;
HiddenField hd;

StringBuilder sb = new StringBuilder();
foreach (DataListItem item in dlContactus.Items)
{

chk = (CheckBox)item.FindControl("chk");

if (chk == null)
continue;
if (chk.Checked == false)
continue;
hd = (HiddenField)item.FindControl("hd");

sb.AppendFormat("{0};", hd.Value);

}

if (sb.ToString() != string.Empty)
{

string strTo = sb.ToString();

if (strTo.Substring(strTo.Length - 1, 1) == ",")
strTo = strTo.Remove(strTo.Length - 1, 1);


string Body = txtContent.Text

Common.SendBulkMail(ConfigurationManager.AppSettings["_ADMIN_MAIL_ID"], strTo, txtSubject.Value, Body, true, false);

blErr.Items.Add("Newsletter send to selected customers");
}
else
{
blErr.Items.Add("Email addresses not selected");
}

break;

}
}


.....................


i want to send content with deactivation code like "http://site/page.aspx?id=email" to corresponding users. each user has seperate deactivation code.

if i use send function for each user it takes lot of time.any method to do it fast.
Posted

1 solution

If the code is different for each user, it cannot be a "multiple recipient e-mail" in principle. Each user should get a separate message. As simple as that. And as fast as it can be. :-)

As to the performance, you waste time on composing a message, which has nothing to do with sending it. You need to compose a message just once, and for each send, just quickly insert two (or so) parameters: "To" address and deactivation code. A message is nothing by a block of plain text, so you always can do it.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900