Skip to content

SSL must not be enabled for pickup-directory delivery method

moorthy subramani

Asked Sep 24, 2013, 3:51 AM EDT3 answers
Share
LinkedInX
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..

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi all,

    I Got the output for my Issue..

    I just use below code... Its working fine now.

    Java
    try
                {
                    SmtpClient sc = new SmtpClient();
                    System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
                    string Ema = txtEmail.Text;
                    MailAddress gonderen = new MailAddress("[email protected]", "Hello");
                    sc.Host = "smtp.gmail.com";
                    sc.Port = 587;
                    sc.EnableSsl = true;
                    mail.To.Add(Ema);
                    mail.Subject = "Confirmation Message for Registration";
                    mail.From = gonderen;
                    mail.IsBodyHtml = true;
                    mail.BodyEncoding = System.Text.Encoding.GetEncoding("ISO-8859-9");
                    mail.Body = "<html><body>Tour Registration Done successfully. Thanks for your Registration";
                    mail.Body += "</body></html>";
                    sc.DeliveryMethod = SmtpDeliveryMethod.Network;
                    sc.Send(mail);
                }
                catch (Exception ex)
                {
                    throw ex;
                }



     <system.net>
        <mailSettings>
          <smtp deliveryMethod="Network"
                      from="[email protected]">
            <network defaultCredentials="false" host="smtp.gmail.com" port="587"
                      userName="[email protected]"  password="Password" />
          </smtp>
        </mailSettings>
      </system.net>

    Thanks,
    0
  • 0
    What is the change that you made with code?
    0
  • 0
    Hi Muralidharan Deenathayalan,

    i didn't add  DeliveryMethod tatz why it was not working..

    i add this line 
     sc.DeliveryMethod = SmtpDeliveryMethod.Network; and its working fine...


    0