Make WordPress Core

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2795 closed defect (bug) (wontfix)

Improved Mail Headers

Reported by: mattyrob's profile mattyrob Owned by:
Milestone: Priority: low
Severity: trivial Version: 2.0.2
Component: General Keywords: WP-Mail headers
Focuses: Cc:

Description

I have written a plugin that I use on my site to improve the mail headers used by WordPress in the pluggable functions. Perhaps these changes could be added to the original code.

if ( !function_exists('wp_mail') ) :
function wp_mail($to, $subject, $message, $headers = '') {
	if( $headers == '' ) {
		$admin = get_userdata('1');
		$headers = "MIME-Version: 1.0\n" .
			"From: " .  $admin->display_name . " <" . $admin->user_email . ">\n" .
			"Return-Path: <" . $admin->user_email .">\n" .
			"Precedence: list\nList-Id: " . get_settings('blogname') . "\n" .
			"Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
	}
	return @mail($to, $subject, $message, $headers);	
}
endif;

Change History (5)

#1 @markjaquith
18 years ago

Could you please explain the reasoning behind the changes? Thanks!

#2 @mattyrob
18 years ago

The changes are small and cosmetic hence the trivial severity rating.

The current wordpress installation sends emails from wordpress@<blog url>.

The changes send the emals from the admin (or first) user of the blog and also adds headers for a return address. I have also added a precendence line indication the email has been sent to a list (may not be appropriate to all) and also identifies the blog site in the list Id (this may help clients identify the email as other than spam)

#3 @markjaquith
18 years ago

Can't have it hardcoded to user #1. That user might not exist. wordpress@server was used because some servers were blocking e-mail that claimed to come from other domains.

#4 @mattyrob
18 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

I hadn't considered that user #1 might not exist. This also means that the Return Path is pointless as the wordpress@server address may not actually exist so replies would bounce.

Guess this can't be done but I'm still happy with my plugin :-)

#5 @(none)
18 years ago

  • Milestone 2.0.4 deleted

Milestone 2.0.4 deleted

Note: See TracTickets for help on using tickets.