Make WordPress Core

Opened 9 years ago

Last modified 4 years ago

#30128 new enhancement

Allow to use associative arrays beside indexed arrays in wp_mail $headers

Reported by: marsjaninzmarsa's profile marsjaninzmarsa Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.3
Component: Mail Keywords: has-patch needs-codex needs-unit-tests needs-refresh
Focuses: Cc:

Description

eg:

$headers = [
	'From' => 'Me Myself <me@example.net>',
	'Cc'   => 'John Q Codex <jqc@wordpress.org>',
];

beside:

$headers = [
	'From: Me Myself <me@example.net>',
	'Cc: John Q Codex <jqc@wordpress.org>',
];

and also (because why not):

$headers = [
	'From' => 'Me Myself <me@example.net>',
	'Cc'   => [
		'John Q Codex <jqc@wordpress.org>',
		'iluvwp@wordpress.org',
	],
];

Attachments (3)

30128.path (1.9 KB) - added by marsjaninzmarsa 9 years ago.
30128.patch (1.9 KB) - added by marsjaninzmarsa 9 years ago.
fixes (typo in previous filename)
30128.2.patch (1.6 KB) - added by jorbin 9 years ago.

Download all attachments as: .zip

Change History (9)

#1 @marsjaninzmarsa
9 years ago

  • Keywords has-patch needs-testing needs-codex added

This ticket was mentioned in IRC in #wordpress-dev by marsjaninzmarsa. View the logs.


9 years ago

#3 @marsjaninzmarsa
9 years ago

It is also possible to use single line notation for multiple CC/BCC, eg:

$headers = [
	'From: Me Myself <me@example.net>',
	'Cc: Fo McFoo <foo@example.com>, bar@example.com',
];

@marsjaninzmarsa
9 years ago

fixes (typo in previous filename)

#4 @boonebgorges
9 years ago

  • Version changed from trunk to 2.3

@jorbin
9 years ago

#5 @jorbin
9 years ago

  • Keywords needs-unit-tests added

This looks like a good idea. It could use some unit tests though to be on the safe side. The current mail unit tests pass.

I've refreshed the patch above so that it applies cleanly.

#6 @desrosj
4 years ago

  • Keywords needs-refresh added; needs-testing removed
  • Milestone set to Future Release

Looks like 30128.2.patch needs an additional refresh on trunk, and still needs unit tests.

Note: See TracTickets for help on using tickets.