Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

Right now, the system is sending a separate email to the BCC email address...
We want it to not be a separate email address. We want it to actually be a BCC on every email sent by the system.
We do not want it to be a separate email because each email cost us.




XML
public static bool SendNewUserRegisterEmailForAdmin(string from, string subject, String FirstName, String LastName, String Companyname, String Email,string Phone)
       {
           TimeOutEntity timeout = CommonFunctions.GetTimeOut();
           bool retVal = ApplicationConstants.BOOL_DEFAULT;
           string EmailTo = string.Empty;
           try
           {
               if (timeout.strNewUserEmailAlert != "")
               {
                   EmailTo = timeout.strNewUserEmailAlert;
               }
              // EmailTo = "jarret@postbidship.com,micky@postbidship.com,kim@postbidship.com";
               //EmailTo = "naveen.impinge@gmail.com,naveen@impingeonline.com";
               String MailBody = GetHtmlBodyAdmin(FirstName, LastName, Companyname,Email,Phone);
               MailBody=MailBody.Replace("\r\n", "<br/>");
               if (timeout.strEmailAlertNewUserAdminBody.Contains("<%strSignature%>"))
               {
                   MailBody = MailBody.Replace("<%strSignature%>", GetAdminSignature());
               }
               MailBody = MailBody.Replace("\r\n", "<br/>");
               if (timeout.strEmailAlertNewUserAdminBody.Contains("<%UnsubscribedAddendum%>"))
               {
                   MailBody = MailBody.Replace("<%UnsubscribedAddendum%>", timeout.strUnsubscribedText);
                   MailBody = MailBody.Replace("<%strSendToRecipientEmailAddress%>", EmailTo);
                   MailBody = MailBody.Replace("<%strSendFromSystemEmailAddress%>", timeout.strFromEmailAddress);
               }
               // Set the from and to address
               MailMessage mailMsg = new MailMessage(from, EmailTo);
               if (timeout.strBCCEmailAddress != "")
               {
                   mailMsg.Bcc.Add(timeout.strBCCEmailAddress);
               }
               //Set the type of Body
               mailMsg.IsBodyHtml = true;
               //Set the Priority
               mailMsg.Priority = System.Net.Mail.MailPriority.Normal;
               //Set the Body and Subject
               mailMsg.Body = MailBody;
               mailMsg.Subject = timeout.strEmailAlertNewUserAdminSubject;
               ClsMail.SetSMTPCredentials(mailMsg);
               retVal = true;
           }
           catch (System.Exception ex)
           {
           }
           finally
           {
           }
           return retVal;
       }
Posted
Updated 18-May-11 8:22am
v2
Comments
pankajupadhyay29 18-May-11 14:02pm    
r u adding those bcc addresses to same MailMessage or not. Could you provide the function u are using to send mail.
amit2620 18-May-11 14:24pm    
yes,I have added them as bcc as per requirement it send mail as another mail to bcc person from system.How system will send a single mail at a time to multiple people
Dave Kreskowiak 18-May-11 16:24pm    
Whatever code you have to send the email has to be causing this. Just because you add a BCC does not mean that the standard SMTPClient sends a seperate copy of the email message. The problem has to be in ClsMail somewhere.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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