Opened 8 years ago
Closed 8 years ago
#7509 closed defect (bug) (fixed)
BP_PHPMailer needs to set the `Date` header
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.5.0 |
Component: | Emails | Keywords: | has-patch |
Cc: |
Description
I'm using a long-running script that includes sending email with BuddyPress native emails.
What I'm seeing is the Date
field is only initialized once during the first send. Subsequent sendouts uses the original date.
The problem is because BuddyPress uses a static version of PHPMailer:
https://buddypress.trac.wordpress.org/browser/tags/2.8.2/src/bp-core/classes/class-bp-phpmailer.php?marks=28,39,47#L27
And PHPMailer doesn't set the Date
field again if one already exists:
https://github.com/WordPress/WordPress/blob/4.7-branch/wp-includes/class-phpmailer.php#L2028
So subsequent mailouts will be sent out with the wrong date, making new emails hard to view in an email client.
My use-case might be a little specific, but I think it will help if we always set the Date
header so other scripts will not run into the same problem as me.
Maybe edge case, but it seems like a flaw in WP's mail date handling nonetheless (one that never really comes up, because even batches of emails are generally expected to be sent out immediately). I'd say go for it.