Ticket #2053: mailfrom.patch

File mailfrom.patch, 2.7 kB (added by sjmurdoch, 2 years ago)

Untested hack to work-around this bug

  • wp-includes/pluggable-functions.php

    old new  
    112112} 
    113113endif; 
    114114 
     115if ( !function_exists('wp_default_mailfrom') ) : 
     116function wp_default_mailfrom() { 
     117        return get_settings('admin_email'); 
     118} 
     119endif; 
     120 
    115121if ( !function_exists('wp_mail') ) : 
    116122function wp_mail($to, $subject, $message, $headers = '') { 
    117123        if( $headers == '' ) { 
    118124                $headers = "MIME-Version: 1.0\n" . 
    119                         "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .  
     125                        "From: " . wp_default_mailfrom() . "\n" .  
    120126                        "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; 
    121127        } 
    122128 
     
    280286        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 
    281287        $notify_message .= sprintf( __('To delete this comment, visit: %s'), get_settings('siteurl').'/wp-admin/post.php?action=confirmdeletecomment&p='.$comment->comment_post_ID."&comment=$comment_id" ) . "\r\n"; 
    282288 
    283         $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); 
     289        $wp_email = wp_default_mailfrom(); 
    284290 
    285291        if ( '' == $comment->comment_author ) { 
    286292                $from = "From: \"$blogname\" <$wp_email>"; 
  • wp-content/plugins/wp-db-backup.php

    old new  
    639639                        $data = chunk_split(base64_encode($file)); 
    640640                        $headers = "MIME-Version: 1.0\n"; 
    641641                        $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n"; 
    642                         $headers .= 'From: ' . get_settings('admin_email') . "\n"; 
     642                        $headers .= 'From: ' . wp_default_mailfrom() . "\n"; 
    643643                 
    644644                        $message = sprintf(__("Attached to this email is\n   %1s\n   Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024)); 
    645645                        // Add a multipart boundary above the plain message 
  • wp-admin/install.php

    old new  
    182182$admin_caps = serialize(array('administrator' => true)); 
    183183$wpdb->query("INSERT INTO $wpdb->usermeta (user_id, meta_key, meta_value) VALUES ({$wpdb->insert_id}, '{$table_prefix}capabilities', '{$admin_caps}');"); 
    184184 
    185 $message_headers = 'From: ' . $weblog_title . ' <wordpress@' . $_SERVER['SERVER_NAME'] . '>'; 
     185$message_headers = 'From: ' . $weblog_title . ' <' . wp_default_mailfrom() . '>'; 
    186186$message = sprintf(__("Your new WordPress blog has been successfully set up at: 
    187187 
    188188%1\$s