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)

Line 
1Index: wp-includes/pluggable-functions.php
2===================================================================
3--- wp-includes/pluggable-functions.php (revision 3129)
4+++ wp-includes/pluggable-functions.php (working copy)
5@@ -132,7 +132,7 @@
6 function wp_mail($to, $subject, $message, $headers = '') {
7        if( $headers == '' ) {
8                $headers = "MIME-Version: 1.0\n" .
9-                       "From: " . get_settings('admin_email') . "\n" .
10+                       "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .
11                        "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
12        }
13 
14@@ -286,14 +286,14 @@
15        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
16        $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";
17 
18-       $admin_email = get_settings('admin_email');
19+       $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
20 
21        if ( '' == $comment->comment_author ) {
22-               $from = "From: \"$blogname\" <$admin_email>";
23+               $from = "From: \"$blogname\" <$wp_email>";
24                if ( '' != $comment->comment_author_email )
25                        $reply_to = "Reply-To: $comment->comment_author_email";
26        } else {
27-               $from = "From: \"$comment->comment_author\" <$admin_email>";
28+               $from = "From: \"$comment->comment_author\" <$wp_email>";
29                if ( '' != $comment->comment_author_email )
30                        $reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
31        }