moving the pop3->delete call to the end of the loop so that emails are deleted if and only if a post is made successfully
git-svn-id: https://develop.svn.wordpress.org/trunk@2176 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5748ed2497
commit
3213112f89
23
wp-mail.php
23
wp-mail.php
@ -24,14 +24,6 @@ for ($i=1; $i <= $count; $i++) :
|
|||||||
|
|
||||||
$message = $pop3->get($i);
|
$message = $pop3->get($i);
|
||||||
|
|
||||||
if(!$pop3->delete($i)) {
|
|
||||||
echo '<p>Oops '.$pop3->ERROR.'</p></div>';
|
|
||||||
$pop3->reset();
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
echo "<p>Mission complete, message <strong>$i</strong> deleted.</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
$content_type = '';
|
$content_type = '';
|
||||||
$boundary = '';
|
$boundary = '';
|
||||||
@ -144,6 +136,11 @@ for ($i=1; $i <= $count; $i++) :
|
|||||||
|
|
||||||
$post_ID = wp_insert_post($post_data);
|
$post_ID = wp_insert_post($post_data);
|
||||||
|
|
||||||
|
if (!$post_ID) {
|
||||||
|
// we couldn't post, for whatever reason. better move forward to the next email
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
do_action('publish_phone', $post_ID);
|
do_action('publish_phone', $post_ID);
|
||||||
|
|
||||||
echo "\n<p><b>Author:</b> $post_author</p>";
|
echo "\n<p><b>Author:</b> $post_author</p>";
|
||||||
@ -165,7 +162,15 @@ for ($i=1; $i <= $count; $i++) :
|
|||||||
($post_ID, $post_category)
|
($post_ID, $post_category)
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
|
if(!$pop3->delete($i)) {
|
||||||
|
echo '<p>Oops '.$pop3->ERROR.'</p></div>';
|
||||||
|
$pop3->reset();
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo "<p>Mission complete, message <strong>$i</strong> deleted.</p>";
|
||||||
|
}
|
||||||
|
|
||||||
endfor;
|
endfor;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user