WordPress.org

Ready to get started?Download WordPress

Forums

Can't automate email-post-checking (13 posts)

  1. mattmend
    Member
    Posted 10 years ago #

    Hi -
    I've tried to set up a cron to automate checking of wp-mail.php however even when I just test it from the command line, it doesn't seem to work properly. I get the following:
    Server:/etc matt$ wget http://192.168.0.25/wordpress/wp-mail.php
    –13:15:03– http://192.168.0.25/wordpress/wp-mail.php
    => wp-mail.php’
    Connecting to 192.168.0.25:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: unspecified [text/html]
    wp-mail.php: Permission denied
    Cannot write to
    wp-mail.php’ (Permission denied).
    Any ideas?
    When I put the URL into a web browser, the page loads and functions fine.
    TIA -
    Matt

  2. mattmend
    Member
    Posted 10 years ago #

    Update: Posting seems to work but the default wp-mail.php is not removing the mail from the account after it posts it. So every time wp-mail checks the account, it reposts messages its already posted. Any idea why?

  3. sufehmi
    Member
    Posted 9 years ago #

    Same problem here - I set cron to run every 5 minutes, and wp-mail.php keeps on fetching the same email (because it didn't delete after fetching it).
    Any pointers will be appreciated.

  4. Anonymous
    Unregistered
    Posted 9 years ago #

    I also have the post problem. I doesn't happen every time, but when it does happen, the email-post doesn't get a category, but I see an error or two....
    1. When running the mail.php manually, it will tell me that Oops, could not delete. "Oops POP3 delete: Command failed [-ERR No such message]". Of course at this point I will end up with multiple identical posts. Identical except that every subsequent email is tacked on.
    Email #1 - #3
    Post #1 contains Email #1
    Post #2 contains Email #2, #1
    Post #3 contains Email #3, #2, #1
    2. Well, as these things go, I couldn't get the software the create the category problem. As memory serves, the error that appears in the wp-admin/edit.php screen is around line 90, no category specified.
    I do have a default category and when the email to post works it gets the default category, just like it should.
    Thanks,\
    Mark

  5. stopha
    Member
    Posted 9 years ago #

    Has there been a resolution for this issue? I'm having the same problem.

    Thanks

  6. skippy
    Member
    Posted 9 years ago #

    Seevral problems have been identified with post-by-email. Please take a look at ticket 1480. Feel free to assist by adding feedback (and patches!).

  7. stopha
    Member
    Posted 9 years ago #

    First, thanks for the quick reply.

    Second, I've been running WP for a couple months using the cron job to automatically run wp-mail, and it has worked beautifully, I'm trying to figure out why this just started out of the blue. Has anyone had this happen?

  8. skippy
    Member
    Posted 9 years ago #

    Have any changes taken place at the mail server? Has the POP3 daemon been replaced with a new version, or replaced by a different daemon?

  9. stopha
    Member
    Posted 9 years ago #

    Well, I've solved my problem, with further investigation, I found there was a MySQL error when trying to insert the post into the database. It was getting fouled up on a quote ' in the word 'don't' - don't know why this happened, but when I took it out, it worked. So there were more than one error going on, and fixing the first error in turn, fixed the subsequent deletion problem.

    the blog is at http://goodsalmon.com/blog/wordpress

  10. naifyboy
    Member
    Posted 8 years ago #

    i cant find anything at all that resolves this problem and have no idea how to fix it. it seems that loads of us have the same issue where email is not being deleted once it has been read by a wordpress.

    this is killing me - there is no way i can blog by mail with it the way it is now.

    does anyone anywhere have a solution for this at all.

    please, please, please can someone somewhere help?

    thanks

  11. aio
    Member
    Posted 7 years ago #

    I've got this problem now. I am using the wp-postie plugin and I had the SQL error that stopha described as well, so I fixed the quote (') issue, and that resolved it I thought, but when I did today a check run on wp-postie it says:

    #!/usr/bin/php -q

    Connecting to mail.advertising-info.org:110 (pop3))
    Mission complete, message 1 deleted.
    Oops POP3 delete: Command failed []\n

    So it looks like it's still an issue - please help!!!

    the blog is at http://advertising-info.org/

  12. aio
    Member
    Posted 7 years ago #

    Found a fix:

    1) open 'postie-functions.php' in /wp-content/plugins/postie
    2) edit the following on line 56:
    CHANGE
    'post_title' => $subject,
    TO
    'post_title' => preg_replace("/'/","\'",$subject),

    This changes the ' into \' - and that was the issue. This should be updated in the source as well - programmers please review this

  13. aio
    Member
    Posted 7 years ago #

    Found out some more info on this as the fix above does not fix all issues. It only worked for some e-mails that had a subject line with a "'" in it.

    Also - You need to do the same for the $content variable too if you haven't done that:

    preg_replace("/'/","\\'",$content),

    I still had the issue on http://advertising-info.org/ so I started throubleshooting some more. It has cost me about 10 hours to find what the issue was. Finally I found it (it's a bug in the standard wordpress code and it is up to 2.0.5 so I got to report this to the wp coders as well):

    In class-pop3.php (in /wp-includes/) there is the following line in the function "get":

    while ( !ereg("^\.\r\n",$line))

    This is incorrect! What happens I think is the following: if a certain message had a "." on a newline (I think this may happen for instance if the "." was just cut-off by the the max lenght of the line and was therefore placed on the next line, or when someone just placed a dot on a line and then a \r\n return/newline.)

    To fix this issue: swap the above to this:

    while (!feof($fp))

    While in fact this will not do much (I do not think that the mail server will actually report an end-of-file) the following piece of the "get" function will now kick-in;

    if(empty($line)) { break; }

    And stop reading from the mail server when the end of the message was reached.

    So the actual issue was that the mail server was unable to delete the message as the message was not completely read and was still being processed. That is where the error "Oops POP3 delete: Command Failed []\n" comes from (it cannot delete the message since it is still open and it will not give an error ("[]") because it cannot do (delete) what the postie-functions.php is asking it to do (delete the messsage).

    I tested this on the message that was failing (line 52 had just a "." on it) and it worked!

    If you want to test for yourself if this is the issue you are having, simply change the code in class-pop3.php to the following:

    while (!feof($fp))
    {

    $MsgArray[$count] = $line;
    $count++;
    $line = fgets($fp,$buffer);
    echo "Read mail line".$count.": ".$line."\n";
    if(empty($line)) {
    echo "Read mail line - Break Issued\n";
    break; }
    }

    This will output all the lines while reading from the mail server (you can see the output of this by manually runing postie from the options in WP)

    Hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.