Link to home
Start Free TrialLog in
Avatar of Moti Mashiah
Moti MashiahFlag for Canada

asked on

C Sharp

Hi guys ,

I have some issue to send email after I implemented this code

            MailMessage mail = new MailMessage();
            mail.To.Add("dataprocessing@althompson.com");
            mail.From = new MailAddress("systeminfo@althompson.com");
            mail.Subject = em.Subject;
            string Body = em.Body;
            mail.Body = Body;
            mail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "172.16.1.6";
            smtp.Port = 587;
            smtp.UseDefaultCredentials = false;
            smtp.Credentials = new System.Net.NetworkCredential("example@domain.com", "password");
            smtp.EnableSsl = true;
            smtp.Send(mail);
            return View();

Open in new window


the issue is in my credential
 smtp.Credentials = new System.Net.NetworkCredential("example@domain.com", "password");
actually in my case exchange server I have to type credential in this way below:

 smtp.Credentials = new System.Net.NetworkCredential("domain\example", "password");

when I type this way I get some error - unrecogniz escape sequence.


I need to know how can I type my user like domain\example without getting this error.
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Moti Mashiah

ASKER

Thank you very much that solved my problem.