moorthy subramani

moorthy subramani

  • NA
  • 19
  • 79.6k

SSL must not be enabled for pickup-directory delivery method

Sep 24 2013 7:51 AM
Hi, 
In My App i am trying to send Email to Customer ID.. When I Create New Web Application and Using Below Code in Button Click Event  its Working Fine. But When I am Using this code in my App Its Showing Error 

Error  : SSL must not be enabled for pickup-directory delivery methods
 
protected void btnSendMail_Click(object sender, EventArgs e)
        {
            string from = "[email protected]"; //Replace this with your own correct Gmail Address
            string to = txtEmail.Text; //Replace this with the Email Address to whom you want to send the mail


            MailMessage mail = new MailMessage();
            mail.To.Add(to);
            mail.From = new MailAddress(from, "Registration", System.Text.Encoding.UTF8);
            mail.Subject = "Registration Done successfully";
            mail.SubjectEncoding = System.Text.Encoding.UTF8;
            mail.Body = "Thanks for Registration with DentTech";
            mail.BodyEncoding = System.Text.Encoding.UTF8;
            mail.IsBodyHtml = true;
            mail.Priority = System.Net.Mail.MailPriority.High;


            SmtpClient client = new SmtpClient();
            //Add the Creddentials- use your own email id and password


            client.Credentials = new System.Net.NetworkCredential(from, "frontdoor");
            client.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
            client.Port = 587; // Gmail works on this port<o:p />
            client.Host = "smtp.gmail.com";
            client.EnableSsl = true; //Gmail works on Server Secured Layer
            try
            {
                client.Send(mail);
            }
            catch (Exception ex)
            {
                Exception ex2 = ex;
                string errorMessage = string.Empty;
                while (ex2 != null)
                {
                    errorMessage += ex2.ToString();
                    ex2 = ex2.InnerException;
                }
                HttpContext.Current.Response.Write(errorMessage);
            }
        }

Please Any one Help Me to Solve this Problem..

Answers (3)