The changes in the function mimemail_headers means that the $sender variable is no longer added to the headers for the mail function.
To fix, I added a check for empty header fields: (sorry, not sure how to make a patch quickly)
// Overwrite standard headers.
if ($from) {
if ( empty($headers['From']) || $headers['From'] == $default_from) {
$headers['From'] = $from;
}
if ( empty($headers['Sender']) || $headers['Sender'] == $default_from) {
$headers['Sender'] = $from;
}
// This may not work. The MTA may rewrite the Return-Path.
if (empty($headers['Return-Path']) || $headers['Return-Path'] == $default_from) {
preg_match('/[a-z0-9\-\.]+@{1}[a-z0-9\-\.]+/i', $from, $matches);
$headers['Return-Path'] = "<$matches[0]>";
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | mimemail-1540762-4-d6.patch | 1.06 KB | sgabe |
| #1 | mimemail-1540762-1-d6.patch | 1.54 KB | sgabe |
Comments
Comment #1
sgabe commentedChecking only for an empty value will throw an error if the header field is not set at all.
Comment #2
Enideo commentedYes, you're right about the use of isset instead of empty, I wasn't thinking very thoroughly.
However your patch doesn't seem to match the original code in 6.x-1.0.
Comment #3
sgabe commentedYeah I think we won't gain much from using a separate function in this case (but would be nicer this way) so it is enough if we just simply add a check for
empty().Comment #4
sgabe commentedAttaching new patch.
Comment #5
Enideo commentedHey sgabe, thanks for all the help by the way :)
Your patch is still from the dev version, but I'm using the 6.x-1.0 version. However perhaps my bug report isn't necessary, as you've already got the isset() in the dev version available for download:
I believe the code in the dev version also fixes my issue, so using empty() may not be necessary. If you agree, then you can close this issue.
Perhaps I should've looked at the dev code first, but I'm trying to avoid all non production-ready code. Maybe you could do a mini-rollout of a new version with this fix, as the current 6.x-1.0 'production version' still has this bug in it. Of course I'm not sure how stable the rest of the code in dev module is, so I'll leave you to judge what to push forward..
Comment #6
sgabe commentedYou should always check the development snapshot before opening a new issue. I thought you have encountered this scenario when the Sender field is set to an empty value...
I am marking this as a duplicate of #1391680: Headers not correctly set.
Comment #7
hukefung commentedHello , do you know how many parameters in $headers array? and what are they. thanks.
Comment #8
hukefung commentedhi, guys , who could tell me that how different between $headers['From'] and $headers['Sender'], Cos I want to use the user typed address instead of the 'smtp_fromname' address of System Configuration for 'from' displaying in the email. Thanks.