修改wordpress默认发邮件邮箱地址

虽然WordPress默认的发邮件地址是wordpress@yourdomain.com,但我们可以将其个性化,比如说改成no-reply@yourdomain.com,这些内容是在“wp-includes\pluggable.php”文件中定义的,使用文本编辑器打开这个文件后找到“wordpress@”后将其替换成你的即可。在WP2.8版本中的位置如下,其它版本可能有差异。
第369行处:

1
2
3
4
5
6
7
8
9
	if ( !isset( $from_email ) ) {
		// Get the site domain and get rid of www.
		$sitename = strtolower( $_SERVER['SERVER_NAME'] );
		if ( substr( $sitename, 0, 4 ) == 'www.' ) {
			$sitename = substr( $sitename, 4 );
		}
 
		$from_email = 'wordpress@' . $sitename;
	}

第1003行处:

1
2
3
4
5
	$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
	$notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
	$notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
	$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));

-EOF-