• Resolved preeve9534

    (@preeve9534)


    I have a site where I need to to upload KML files via Postie.

    The files are emailed as a MIME attachment with the type” application/vnd.google-earth.kml+xml”

    wp-config.php includes the line “define(‘ALLOW_UNFILTERED_UPLOADS’, true);” and I have added “application” as an allowed MIME type in Postie settings.

    I am able to successfully:

    1. Upload a KML file directly via WordPress’s media upload page.
    2. Send an email with a KML attachment to my Postie email account and have Postie upload it by clicking on the “Process email” and “Debug” buttons one the Postie settings page.

    However, when Postie runs unattended through its background scheduler the KML attachment is rejected and a notification email issued saying “Sorry, this file type is not permitted for security reasons.” The Apache logs record the error, but nothing else that helps explain it.

    [Also, adding the KML MIME type in the Enhanced Media Plugin has no effect.]

    Can anyone offer any advice?

    Thanks,

    Paul

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Wayne Allen

    (@wayneallen-1)

    I don’t think using ALLOW_UNFILTERED_UPLOADS will work for Postie as that only seems to work with the interactive upload.

    Try setting “Force User Login” to yes (Postie User tab) and see if that helps.

    Thread Starter preeve9534

    (@preeve9534)

    Hi Wayne,

    Thank you for the advice.

    Force User Login = yes doesn’t solve the issue: in fact it stops the interactive upload working as well.

    I tried forcing the MIME type on my email attachment to just text/kml, but that made no difference either.

    P

    Plugin Author Wayne Allen

    (@wayneallen-1)

    >Force User Login = yes doesn’t solve the issue: in fact it stops the interactive upload working as well

    Then something else is wrong because this setting has no affect outside of Postie processing an email.

    Thread Starter preeve9534

    (@preeve9534)

    Hi Wayne,

    Thank you again. I’ve looked a little more deeply:

    The MIME descriptor in the email being processed reads:

    Content-Disposition: attachment; filename=20190712.kml
    Content-Type: application/vnd.google-earth.kml+xml; name=20190712.kml

    However, the Debug output in Postie looks like this:

    save_attachments: —- start
    save_attachments: [attachment]
    save_attachments_worker: start
    save_attachments_worker: [filename]: 20190712.kml
    save_attachments_worker: [mimetype]: text/kml
    save_attachments_worker: 20190712.kml
    save_attachment: pre sanitize file name ‘20190712.kml’
    save_attachment: file name ‘20190712.kml’
    save_attachment: extension ‘kml’
    save_attachment: secondary lookup found text/kml
    save_attachment: mimetype text/kml
    save_attachment: ctype_primary: text
    save_attachment: text Attachement: 20190712.kml
    media_handle_upload: wrote data to ‘/tmp/postiesV4xee’
    Array
    (
    [name] => 20190712.kml
    [type] => text/kml
    [tmp_name] => /tmp/postiesV4xee
    [error] => 0
    [size] => 4224
    )
    doing postie_file_added_pre
    media_handle_sideload: adding 20190712.kml
    There was an error adding the attachment: Sorry, this file type is not permitted for security reasons.

    I can upload through WordPress’ Media interface both the application/ and the text/ MIME types.

    Postie is configured with “application” as an additional allowed type and the documentation says “….text/ type is always allowed. So, it seems to me that:

    1. For some reason the application/… MIME type in the email attachment is being replaced (by Postie?) as text/kml. Odd?

    and

    2. The new text/kml type is then being rejected even though the documentation says it should be being allowed. Also odd?

    Not sure what else I can do to resolve this. Do you have any more pointers?

    Regards,

    Paul

    Plugin Author Wayne Allen

    (@wayneallen-1)

    The next step would be to install the Support Add-on to collect some detailed logs. See http://postieplugin.com/downloads/support-addon/

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Error adding the attachment, but only in background’ is closed to new replies.