WordPress.org

Make WordPress Core

Ticket #1532: email_from_wordpress_at_domain.diff

File email_from_wordpress_at_domain.diff, 1.6 KB (added by markjaquith, 8 years ago)

Email sent from wordpress@domain (with "www." stripped)

  • wp-includes/pluggable-functions.php

     
    132132function wp_mail($to, $subject, $message, $headers = '') { 
    133133        if( $headers == '' ) { 
    134134                $headers = "MIME-Version: 1.0\n" . 
    135                         "From: " . get_settings('admin_email') . "\n" .  
     135                        "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .  
    136136                        "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; 
    137137        } 
    138138 
     
    286286        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 
    287287        $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"; 
    288288 
    289         $admin_email = get_settings('admin_email'); 
     289        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])); 
    290290 
    291291        if ( '' == $comment->comment_author ) { 
    292                 $from = "From: \"$blogname\" <$admin_email>"; 
     292                $from = "From: \"$blogname\" <$wp_email>"; 
    293293                if ( '' != $comment->comment_author_email ) 
    294294                        $reply_to = "Reply-To: $comment->comment_author_email"; 
    295295        } else { 
    296                 $from = "From: \"$comment->comment_author\" <$admin_email>"; 
     296                $from = "From: \"$comment->comment_author\" <$wp_email>"; 
    297297                if ( '' != $comment->comment_author_email ) 
    298298                        $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>"; 
    299299        }