Click here to Skip to main content
16,021,417 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello,
i have a block of code to send a confirmation email after user resets his passowrd
here is my code:
C#
private static void confirmationEmail(string email, string customerName, string customerCode)
        {
            string messageBody = "hello world";
            string url = "www.abc.com";
            string hyperlink = "<a href='" + url + "'>" + " abc Distribution" + "</a>";
            NetworkCredential logininfo = new NetworkCredential("example1@automob.com", "********");
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress("communications@abc.com");
            msg.To.Add(new MailAddress(email));
            msg.Bcc.Add(new MailAddress("example2@abc.com"));
            msg.Subject = "Confirmation - Your password has been changed!";
            msg.Body = messageBody;
            msg.IsBodyHtml = true;
            SmtpClient client = new SmtpClient("smtp.globetrotter.net");
            client.EnableSsl = false;
            client.UseDefaultCredentials = false;
            client.Credentials = logininfo;
            client.Send(msg);
        }


i have 2 problems:
1- most of the emails go to users spam or junk
2- is not sending Bcc.
any help would be much appreciated.

Thank you
Posted
Comments
Richard Deeming 5-Mar-15 12:08pm    
Is smtp.globetrotter.net configured as an authorized sender for the abc.com domain? If not, your messages will be rejected by many servers as spoofed.
Samira Radwan 5-Mar-15 12:47pm    
thanks for your comment, i did configure the stmp on iis and receiving emails now normally in inbox, but still bcc.
thanks
ZurdoDev 5-Mar-15 12:09pm    
If it sends the email then BCC is working unless your mail server has an issue. Check spam folders on BCC side too.
Samira Radwan 5-Mar-15 12:48pm    
i have checked many time spam, but no! not receiving bcc
thanks

1) You cannot be held responsible for recipient's spam protection software and change; 2) the BCC address might not exist; use the address which works. You can check up everything using some valid addresses and some available mail software.

—SA
 
Share this answer
 
For the BCC issue, this[^] might help you.
 
Share this answer
 
Comments
Samira Radwan 5-Mar-15 12:52pm    
thank you, i have read it
but i don't use exchange server or PickupDirectoryLocation in my code.
do i have to use it?i mean (PickupDirectoryLocation)? please explain
thanks

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