locked
All emails go to the Badmail folder because of file ownership RRS feed

  • Question

  • Hello,

    I have Windows Server 2008 with IIS role and SMTP featured installed. I created my default website with a form to send emails to myself.

    When I manually create a text file with From, To and Subject header and drag it in the Pickup folder, it goes in Drop/Queued (depending of who is in To)

    When I create the text file from a form on my default website and copy it in the Pickup folder, it goes in Badmail.

    The only difference is that the file created locally is owned by Administrator and the bad one by Network Service.

    I added Network Service with full rights to the inetpub, mailroot and all the folders inside - same problem.

    I enabled anonymous authentication. Now the owner of the text file created from webform is IUSR - still same problem

    I added IUSR with full rights to all the folders under inetpub - same problem

    I set the IIS application pool identity to Local Service and I edited the Anonymous Authentication for my default website to use Application pool identity. I added the Local Service with full rights to all my folders - same problem.

    What I couldn't do - I tried to set the specific user for the Anonymous identity to be an admin username and to set a password... but I'm warned that the password is incorrect.

    In IIS6 SMTP Virtual Server > Properties > Security tab, I tried to grant operator permission to IUSR or Local Service but it doesn't work. I can only select users under my local domain.

    Is there anything I can do to change the owner and have the file sent in Drop/Queued ?

    Regards,

    Alex


    Tuesday, March 4, 2014 10:23 PM

Answers

  • After more research I couldn't find a way to change the owner of the file created by the Network Service. So I had to use the System.Net.Mail.SmtpClient class:

    Protected Sub SendButton_Click(sender As Object, e As EventArgs)
            Dim MailObj As New System.Net.Mail.SmtpClient 
            MailObj.Host = "localhost" 
            MailObj.Send(From.Text, "mymail@mydomain", Subject.Text, Message.Text) 
            Page.ClientScript.RegisterStartupScript(me.GetType(), "Alert", "alert('"& "Email sent." &"');", true)
        End Sub

    where From.Text, Subject.Text and Message.Text are taken from text boxes in the form.

    Now the mail files are owned by Administrators, they are given .eml extension and they are sent to the Pickup folder as I wish. 

    • Marked as answer by Andy Qi Wednesday, April 2, 2014 12:34 PM
    Tuesday, March 25, 2014 10:35 PM

All replies

  • Maybe you should ask the question in the SharePoint forum.

    http://social.technet.microsoft.com/Forums/sharepoint/en-US/home?category=sharepoint

    • Marked as answer by Andy Qi Tuesday, March 25, 2014 3:08 AM
    • Unmarked as answer by Andy Qi Tuesday, March 25, 2014 3:08 AM
    Sunday, March 23, 2014 11:31 AM
  • After more research I couldn't find a way to change the owner of the file created by the Network Service. So I had to use the System.Net.Mail.SmtpClient class:

    Protected Sub SendButton_Click(sender As Object, e As EventArgs)
            Dim MailObj As New System.Net.Mail.SmtpClient 
            MailObj.Host = "localhost" 
            MailObj.Send(From.Text, "mymail@mydomain", Subject.Text, Message.Text) 
            Page.ClientScript.RegisterStartupScript(me.GetType(), "Alert", "alert('"& "Email sent." &"');", true)
        End Sub

    where From.Text, Subject.Text and Message.Text are taken from text boxes in the form.

    Now the mail files are owned by Administrators, they are given .eml extension and they are sent to the Pickup folder as I wish. 

    • Marked as answer by Andy Qi Wednesday, April 2, 2014 12:34 PM
    Tuesday, March 25, 2014 10:35 PM