I am not sure if this is me or the CC and BCC do not work. Debugging $message in htmlmail_mail() I see that the headers do not contain my CC and BCC that I sent with the $params.
My code to send mail is:
$params = array (
'subject' => $subject,
'body' => check_markup($body_text, 'full_html'),
'headers' => array('Cc' => $cc, 'Bcc' => $bcc),
);
drupal_mail('htmlmail', $module, $to, language_default(), $params, $from);
I added a line in htmlmail_mail() as follows:
$message['headers'] = array_merge($message['headers'], $params['headers']);
and it seems to work for me. Am I doing it wrong? Is this already in place somewhere and I am not using it correctly?
Comments
Comment #1
unqunqComment #2
badjava commentedI had the same issue and fixed it with the suggestion above. Attached is the patch.
Comment #3
badjava commentedAdded an isset() to ensure the headers exist first before merging.
Comment #4
Utkarsh_Mishra commentedComment #5
salvisThis needs to be tested against 2.70, and I'd like to get some more review feedback.
Please don't assign yourself unless you want to signal that you're actively working on an issue.
Comment #6
salvisOk, this looks reasonable. Does it already work in D8?
Comment #7
Vidushi Mehta commented#3 Does not apply on 8.x-3.x-dev but the code which was added by #3 is already there in the module file. So I think this issue should be closed and committed. Added a screenshot.
Comment #8
salvisThank you for checking this, Vidushi Mehta!
Comment #10
salvisComment #12
q11q11 commentedAdding pach for format() method, which also was not storing custom headers passed with $message['params']['headers'].
Solution is same as in #3.
Made it against current 7.x-2.x (@e21f912).