WordPress.org

Ready to get started?Download WordPress

Forums

Postie: no styles with cronjob (8 posts)

  1. Schavuit
    Member
    Posted 8 years ago #

    I just got Postie 0.9.9.3.2 running on WordPress 2.02. It works great. However strange is that when I manually add the mail to the page (by pressing the ‘run Postie’ button in the Postie options), all the styles are applied. But when the mail is added by a cronjob, the message appears without styles.

    The styles I added to the Postie options:
    border: 1px solid; display: block; margin-left: auto; margin-right: auto;

    I posted exactly the same mail twice. One time manual, and one time by the cron job

    The Cron job:
    */5 * * * * /usr/bin/lynx --source http://www.schavuit.com/wordpress/wp-content/plugins/postie/get_mail.php >/dev/null 2>&1

    Source after posted manual:
    <img src="http://www.schavuit.com/wordpress/wp-photos/thumb.20060503-142147-1.jpg" alt="DSC00131.JPG" title="DSC00131.JPG" style="border: 1px solid; display: block; margin-left: auto; margin-right: auto;" class="postie-image" />

    Source after posted by the cronjob:
    <img src="http://www.schavuit.com/wordpress/wp-photos/thumb.20060503-140501-1.jpg" alt="DSC00131.JPG" />

    How can I resolve this?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    That's freakin' weird. The Run Postie button does the exact same thing, it just gets that "get_mail.php" page.

    Try using wget instead of lynx. I use wget myself, haven't had any issues with it.

  3. memeslider
    Member
    Posted 7 years ago #

    I also am having the same issue. How strange.

    I will try wget as well, but if anyone has any input, I'd like to hear it.

  4. John
    Member
    Posted 7 years ago #

    I tried both curl and wget on my cron and had the same problem. Formatting that shows up fine in the post when the mail is checked manually is removed when the mail is checked using cron. Very frustrating.

  5. keford
    Member
    Posted 7 years ago #

    I've tracked it down to the apply_filters() function call in post.php. When postie is called from cron, the apply_filters strips out the CSS and also changes from a popup window for full sized image to using the same window. Still looking...

    // Get the basics.
    if ( empty($no_filter) ) {
       $post_content    = apply_filters('content_save_pre',   $post_content);
  6. keford
    Member
    Posted 7 years ago #

    Okay, using cron, the following filters are applied:

    wp_filter_post_kses
    balanceTags

    Using postie admin panel, only this filter is applied.

    balanceTags

    So the 'wp_filter_post_kses' is killing the postie styling and popup window. Anybody know how to tell postie to not run that filter?

  7. keford
    Member
    Posted 7 years ago #

    Made this change to kses.php and things got better. Did I open any security doors by doing this?

    function kses_init_filters() {
    	// Normal filtering.
    	add_filter('pre_comment_content', 'wp_filter_kses');
    	add_filter('title_save_pre', 'wp_filter_kses');
    
    	// Post filtering
    //keep postie happy.	add_filter('content_save_pre', 'wp_filter_post_kses');
    	add_filter('excerpt_save_pre', 'wp_filter_post_kses');
    	add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
    }
  8. John
    Member
    Posted 7 years ago #

    keford
    Thank You! Thank You Again!
    This, for me, is pretty thrilling.
    Much Appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic