Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
Hi, i added this code in a custom module (for D7-version). However, the mails are considered BCC, not CC.
It uses the user reference fields field_ in the nodes of type that are sent.
It would be nice if this (in some way) could be incorporated in the module.
function <my_module>_form_print_mail_form_alter(&$form, &$form_state) {
// read node from first numeric path part
$path_parts = explode('/',$form['path']['#value']);
foreach ($path_parts as $part) {
if (is_numeric($part)) {
$node = node_load($part);
break;
}
}
if($node->type == <my_node_type>) {
$emailadresses = array();
if(!empty($node->field_<my_user_ref>)) {
foreach($node->field_<my_user_ref> AS $lng => $records) {
foreach($records AS $key => $record) {
$user = user_load($record['uid']);
$emailadresses[] = $user->mail;
}
}
}
$form['txt_to_addrs']['#default_value'] = implode("\n", $emailadresses);
$form['fld_subject']['#default_value'] = t('My title !nid - !title', array('!title' => $node->title, '!nid' => $node->nid));
$form['txt_message']['#required'] = false;
}
return $form;
}
#1 for @beyond67: no there is no way to do that. The module sends all e-mails separately to each address, so a cc: or bcc: are indistinguishible from the original to:.. However what you're asking is to be able to add somewhere in the configuration page a list of addresses that will also receive the e-mail.. This wouldn't be complicated to do, but the module doesn't do it.
#2 for johnv: you're code is specific to your needs. This has no way to be part of the module.
Comments
Comment #1
johnvHi, i added this code in a custom module (for D7-version). However, the mails are considered BCC, not CC.
It uses the user reference fields field_ in the nodes of type that are sent.
It would be nice if this (in some way) could be incorporated in the module.
Comment #2
jcnventura#1 for @beyond67: no there is no way to do that. The module sends all e-mails separately to each address, so a cc: or bcc: are indistinguishible from the original to:.. However what you're asking is to be able to add somewhere in the configuration page a list of addresses that will also receive the e-mail.. This wouldn't be complicated to do, but the module doesn't do it.
#2 for johnv: you're code is specific to your needs. This has no way to be part of the module.