web/wp-mail.php
branchwordpress
changeset 132 4d4862461b8d
parent 109 03b0d1493584
equal deleted inserted replaced
131:a4642baaf829 132:4d4862461b8d
     8  */
     8  */
     9 
     9 
    10 /** Make sure that the WordPress bootstrap has run before continuing. */
    10 /** Make sure that the WordPress bootstrap has run before continuing. */
    11 require(dirname(__FILE__) . '/wp-load.php');
    11 require(dirname(__FILE__) . '/wp-load.php');
    12 
    12 
       
    13 /** Allow a plugin to do a complete takeover of Post by Email **/
       
    14 do_action('wp-mail.php');
       
    15 
    13 /** Get the POP3 class with which to access the mailbox. */
    16 /** Get the POP3 class with which to access the mailbox. */
    14 require_once( ABSPATH . WPINC . '/class-pop3.php' );
    17 require_once( ABSPATH . WPINC . '/class-pop3.php' );
    15 
    18 
       
    19 /** Only check at this interval for new messages. */
       
    20 if ( !defined('WP_MAIL_INTERVAL') )
       
    21 	define('WP_MAIL_INTERVAL', 300); // 5 minutes
       
    22 
       
    23 $last_checked = get_transient('mailserver_last_checked');
       
    24 
       
    25 if ( $last_checked )
       
    26 	wp_die(__('Slow down cowboy, no need to check for new mails so often!'));
       
    27 
       
    28 set_transient('mailserver_last_checked', true, WP_MAIL_INTERVAL);
       
    29 
    16 $time_difference = get_option('gmt_offset') * 3600;
    30 $time_difference = get_option('gmt_offset') * 3600;
    17 
    31 
    18 $phone_delim = '::';
    32 $phone_delim = '::';
    19 
    33 
    20 $pop3 = new POP3();
    34 $pop3 = new POP3();
       
    35 $count = 0;
    21 
    36 
    22 if ( ! $pop3->connect(get_option('mailserver_url'), get_option('mailserver_port') ) ||
    37 if ( ! $pop3->connect(get_option('mailserver_url'), get_option('mailserver_port') ) ||
    23 	! $pop3->user(get_option('mailserver_login')) ||
    38 	! $pop3->user(get_option('mailserver_login')) ||
    24 	( ! $count = $pop3->pass(get_option('mailserver_pass')) ) ) {
    39 	( ! $count = $pop3->pass(get_option('mailserver_pass')) ) ) {
    25 		$pop3->quit();
    40 		$pop3->quit();