Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to I make EmailButton_Click work?

How to I make EmailButton_Click work?

Scheduled Pinned Locked Moved ASP.NET
helpquestioncsharpcomsysadmin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11369001
    wrote on last edited by
    #1

    My code for EmailButton_Click is not working. I am getting an error System.Net.Mail.SmtpException: 'SSL must not be enabled for pickup-directory delivery methods.' so email is not sent. How can I fix this? Here is the code

    protected void EmailButton_Click(object sender, EventArgs e)
    {
    //get selected email

            string requestor = RequestorDropDownList.SelectedValue.ToString();
            //string message = "The following records have been prepped for processing.  Valid cases will be processed.{0}{1}{2}";
            string message = "The following records have been prepped for processing.  Valid cases will be processed.";
            if (requestor.Length > 0)
                message = string.Format(message);
            using (MailMessage mailMessage = new MailMessage())
                {
                    mailMessage.From = new MailAddress("NoReply\_FTA@courts.state.mn.us");
                   //MailAddress to = new MailAddress(requestorEmail);
                    MailAddress to = new MailAddress("okaymy1112@gmail.com");
                    mailMessage.To.Add(to);
                                      
                    string ccEmailAddress = "okaymy1112@mail.com";
                    if (ccEmailAddress.Length > 0)
                    {
                        MailAddress ccto = new MailAddress(ccEmailAddress);
                        mailMessage.CC.Add(ccto);
                    }
    
                    mailMessage.Subject = "FTA Case Reset Notice";
                    mailMessage.Body = message;
                    mailMessage.IsBodyHtml = true;
    
                    SmtpClient smtpClient = new SmtpClient();
                    smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                    smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                    smtpClient.PickupDirectoryLocation = @"c:\\smtp";
                    smtpClient.EnableSsl = true;
                    smtpClient.UseDefaultCredentials = true;
                    smtpClient.Timeout = 60000;
    
                    smtpClient.Send(mailMessage);//Error occurs on this line
    
                    ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('An email has been sent to '" + requestorName + "');", true);
        }
    
    Z F 2 Replies Last reply
    0
    • U User 11369001

      My code for EmailButton_Click is not working. I am getting an error System.Net.Mail.SmtpException: 'SSL must not be enabled for pickup-directory delivery methods.' so email is not sent. How can I fix this? Here is the code

      protected void EmailButton_Click(object sender, EventArgs e)
      {
      //get selected email

              string requestor = RequestorDropDownList.SelectedValue.ToString();
              //string message = "The following records have been prepped for processing.  Valid cases will be processed.{0}{1}{2}";
              string message = "The following records have been prepped for processing.  Valid cases will be processed.";
              if (requestor.Length > 0)
                  message = string.Format(message);
              using (MailMessage mailMessage = new MailMessage())
                  {
                      mailMessage.From = new MailAddress("NoReply\_FTA@courts.state.mn.us");
                     //MailAddress to = new MailAddress(requestorEmail);
                      MailAddress to = new MailAddress("okaymy1112@gmail.com");
                      mailMessage.To.Add(to);
                                        
                      string ccEmailAddress = "okaymy1112@mail.com";
                      if (ccEmailAddress.Length > 0)
                      {
                          MailAddress ccto = new MailAddress(ccEmailAddress);
                          mailMessage.CC.Add(ccto);
                      }
      
                      mailMessage.Subject = "FTA Case Reset Notice";
                      mailMessage.Body = message;
                      mailMessage.IsBodyHtml = true;
      
                      SmtpClient smtpClient = new SmtpClient();
                      smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                      smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                      smtpClient.PickupDirectoryLocation = @"c:\\smtp";
                      smtpClient.EnableSsl = true;
                      smtpClient.UseDefaultCredentials = true;
                      smtpClient.Timeout = 60000;
      
                      smtpClient.Send(mailMessage);//Error occurs on this line
      
                      ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('An email has been sent to '" + requestorName + "');", true);
          }
      
      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      All you have to do is google the error if you do not understand what the error is telling you. My first google result has an option that fixed it for a particular user, smtpclient - getting the error: SSL must not be enabled for pickup-directory delivery methods - Stack Overflow[^]

      Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

      1 Reply Last reply
      0
      • U User 11369001

        My code for EmailButton_Click is not working. I am getting an error System.Net.Mail.SmtpException: 'SSL must not be enabled for pickup-directory delivery methods.' so email is not sent. How can I fix this? Here is the code

        protected void EmailButton_Click(object sender, EventArgs e)
        {
        //get selected email

                string requestor = RequestorDropDownList.SelectedValue.ToString();
                //string message = "The following records have been prepped for processing.  Valid cases will be processed.{0}{1}{2}";
                string message = "The following records have been prepped for processing.  Valid cases will be processed.";
                if (requestor.Length > 0)
                    message = string.Format(message);
                using (MailMessage mailMessage = new MailMessage())
                    {
                        mailMessage.From = new MailAddress("NoReply\_FTA@courts.state.mn.us");
                       //MailAddress to = new MailAddress(requestorEmail);
                        MailAddress to = new MailAddress("okaymy1112@gmail.com");
                        mailMessage.To.Add(to);
                                          
                        string ccEmailAddress = "okaymy1112@mail.com";
                        if (ccEmailAddress.Length > 0)
                        {
                            MailAddress ccto = new MailAddress(ccEmailAddress);
                            mailMessage.CC.Add(ccto);
                        }
        
                        mailMessage.Subject = "FTA Case Reset Notice";
                        mailMessage.Body = message;
                        mailMessage.IsBodyHtml = true;
        
                        SmtpClient smtpClient = new SmtpClient();
                        smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                        smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                        smtpClient.PickupDirectoryLocation = @"c:\\smtp";
                        smtpClient.EnableSsl = true;
                        smtpClient.UseDefaultCredentials = true;
                        smtpClient.Timeout = 60000;
        
                        smtpClient.Send(mailMessage);//Error occurs on this line
        
                        ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('An email has been sent to '" + requestorName + "');", true);
            }
        
        F Offline
        F Offline
        F ES Sitecore
        wrote on last edited by
        #3

        The error is self-explanatory. You are using both SSL and a pickup folder, you can't use both. You either send over the network and use SSL, or write to the pickup folder which has no support for SSL. If you want to use the pickup folder don't set EnableSsl to true.

        U 1 Reply Last reply
        0
        • F F ES Sitecore

          The error is self-explanatory. You are using both SSL and a pickup folder, you can't use both. You either send over the network and use SSL, or write to the pickup folder which has no support for SSL. If you want to use the pickup folder don't set EnableSsl to true.

          U Offline
          U Offline
          User 11369001
          wrote on last edited by
          #4

          Can you kindly help or guide me on doing it the way you described? For example based on my code how can I can it so that 1. I can send email over the network and use SSL or 2. write to the pickup folder which has no support for SSL

          F 1 Reply Last reply
          0
          • U User 11369001

            Can you kindly help or guide me on doing it the way you described? For example based on my code how can I can it so that 1. I can send email over the network and use SSL or 2. write to the pickup folder which has no support for SSL

            F Offline
            F Offline
            F ES Sitecore
            wrote on last edited by
            #5

            The solution depends on if you want to use the pick-up folder or send over the network, something you haven't indicated.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups