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 do I fix System.Net.Mail.SmtException: 'Cannot get IIS pickup directory' error?

How do I fix System.Net.Mail.SmtException: 'Cannot get IIS pickup directory' error?

Scheduled Pinned Locked Moved ASP.NET
helpquestioncsharpcomwindows-admin
3 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

    I am trying to send email using the EmailButton_Click code. However I am getting the error on this line smtp.Send(mailMessage) The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.' Can someone help me fix it please?

    protected void EmailButton_Click(object sender, EventArgs e)
    {
    //get selected email
    EmailButton.Visible = true;
    string requestor = RequestorDropDownList.SelectedValue.ToString();
    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");
    //Uncomment after testing in Deve June 2019
    MailAddress to = new MailAddress(requestor);
    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;
    SmtpClient smtp = new SmtpClient();
    smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
    smtp.Send(mailMessage);//Error on this line
    }
    string msg = "No batches were found";
    Response.Write("alert('" + msg + "')");
    }

    L Z 2 Replies Last reply
    0
    • U User 11369001

      I am trying to send email using the EmailButton_Click code. However I am getting the error on this line smtp.Send(mailMessage) The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.' Can someone help me fix it please?

      protected void EmailButton_Click(object sender, EventArgs e)
      {
      //get selected email
      EmailButton.Visible = true;
      string requestor = RequestorDropDownList.SelectedValue.ToString();
      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");
      //Uncomment after testing in Deve June 2019
      MailAddress to = new MailAddress(requestor);
      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;
      SmtpClient smtp = new SmtpClient();
      smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
      smtp.Send(mailMessage);//Error on this line
      }
      string msg = "No batches were found";
      Response.Write("alert('" + msg + "')");
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      This is much the same issue as you posted a couple of days ago below at How to I make EmailButton_Click work? - ASP.NET Discussion Boards[^], and you appear to be trying to learn how to make it work by posting questions one at a time. Can i suggest that you study the SMTP documentation more closely to see exactly how you should be using these features. If you want to use PickupDirectoryFromIis then you most likely need to configure it within IIS.

      1 Reply Last reply
      0
      • U User 11369001

        I am trying to send email using the EmailButton_Click code. However I am getting the error on this line smtp.Send(mailMessage) The error is System.Net.Mail.SmtpException: 'Cannot get IIS pickup directory.' Can someone help me fix it please?

        protected void EmailButton_Click(object sender, EventArgs e)
        {
        //get selected email
        EmailButton.Visible = true;
        string requestor = RequestorDropDownList.SelectedValue.ToString();
        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");
        //Uncomment after testing in Deve June 2019
        MailAddress to = new MailAddress(requestor);
        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;
        SmtpClient smtp = new SmtpClient();
        smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
        smtp.Send(mailMessage);//Error on this line
        }
        string msg = "No batches were found";
        Response.Write("alert('" + msg + "')");
        }

        Z Offline
        Z Offline
        ZurdoDev
        wrote on last edited by
        #3

        First google result has some possible fixes, https://stackoverflow.com/questions/2190361/cannot-get-iis-pickup-directory

        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
        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