WordPress.org

Support

Support » How-To and Troubleshooting » Postie: no styles with cronjob

Postie: no styles with cronjob

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    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.

    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.

    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.

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

    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?

    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');
    }

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Postie: no styles with cronjob’ is closed to new replies.