0

Does anyone have a solution to adding a CC field to the /node/[nid]/webform/emails/xxx interface?

I have a client that wants to use a decently complex conditional email send solution in Drupal 7 webform, where based on various select lists, it will send an email to two places.

  1. "Real_Person@domain.com"

  2. "Ticket_System@domain.com"

Allowing a real person to be notified and respond via REPLY-ALL to the email, and having the ticket system be updated with the communication in real time.

The ticket system can't handle getting a reply-to with both addresses in the single "TO:" line.

to: Real_Person@domain.com,Ticket_System@domain.com breaks the system.

Has anyone solved this? built a module? Have guidance on how to solve?

Thank you!

Add a CC field to webform emaill addresses

0

I have done some similar thing to send the email to another email-address. You can use the following solution for changing the content of the email or to add an attachment or things like this...

/**
 * Implements hook_mail_alter().
 */
function MYMODULE_mail_alter(&$message) {
  // Check message id
  if ($message['id'] == '...') {
    $email_key = 'new_email_key_if_you_want';

    // Block email which is sending right now.
    $message['send'] = FALSE;

    // send original email
    drupal_mail('MYMODULE', $email_key, $message['to'], language_default(), $message['params'], $message['from']);

    // send copy of the email.
    drupal_mail('MYMODULE', $email_key, 'ticket_system@domain.com', language_default(), $message['params'], $message['from']);
  }
}

You can add this in an own module, in the MYMODULE.module.

  • Thank you. Does if($message['id']...) allow me to define different CC addresses based on the which webform email condition is triggered? – alphex Jan 12 '18 at 16:16
  • Hi @alphex Mh i'm not sure. Probably yes: each type of email in drupal gets a individual key. Either it is an email-key based on the webforms (each type of webform gets an own key) or, (and this would be bad for you) the key is based just on the module webform. You have to try. – btemperli Jan 13 '18 at 6:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.