in the `/node/[nid]/webform/emails/1` screen, has anyone built functionality to add a "cc" field after the "email address" field?
Allowing a second set of addresses to be CC'ed?

for example

Add a CC field

I have an issue where an email needs to be sent to a person and to a ticket tracking system, but the ticket tracking system can't handle an email sent TO: multiple addresses.

Where : "real_person@domain.com,ticket_system@domain.com" doesn't work and the ticket system chokes on the email being sent that way.
It needs to be a CC value.

Has anyone done this? or know of a way of handling this?

This is a complex webform with many conditional email triggers. 12 different email triggers, each conditional for various select options.

Thank you.

Comments

alphex created an issue. See original summary.

alphex’s picture

Issue summary: View changes
StatusFileSize
new112.94 KB
damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new47.83 KB
new35.31 KB
new29.63 KB
new7.94 KB

This patch adds support for sending emails via CC.

The emails list:
Emails list

The email form:
Email form

What the email headers look like after sending.
Email headers

Status: Needs review » Needs work

The last submitted patch, 3: webform-n2936257-3.patch, failed testing. View results

damienmckenna’s picture

Assigned: Unassigned » damienmckenna

Not sure what's up with the tests, but I'm going to write a new test to check the email handling.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new13.78 KB
new6 KB

This fixes a few minor bugs in the last patch, and adds a test that steps through the email creation process. Next up, testing email creation after a form submission.

Status: Needs review » Needs work

The last submitted patch, 6: webform-n2936257-6.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new21.93 KB

Email submission tests. Woot.

Status: Needs review » Needs work

The last submitted patch, 8: webform-n2936257-8.patch, failed testing. View results

damienmckenna’s picture

I opened a support request about the test errors: #2938323: Webform test runs are throwing a drush error

liam morland’s picture

Status: Needs work » Needs review
damienmckenna’s picture

Status: Needs review » Needs work
StatusFileSize
new61.93 KB

Forgot to unassign it, but a bug was discovered so I'll continue working on it.

Right now it doesn't handle having separate CC addresses depending upon different values:
This doesn't work

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new3.43 KB
new24.68 KB

This should throw a test failure.

Status: Needs review » Needs work

The last submitted patch, 13: webform-n2936257-13.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new3.61 KB
new24.53 KB

Ok, this is a better test - make sure that one of the TO addresses was used, that one of the CC addresses was used and that the email was not CC'd to a TO address.

Status: Needs review » Needs work

The last submitted patch, 15: webform-n2936257-15.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new24.46 KB
new1.25 KB

And I think this solves the problem :)

damienmckenna’s picture

Assigned: damienmckenna » Unassigned
damienmckenna’s picture

StatusFileSize
new12.32 KB
new28.73 KB

Ok, another thing.. BCC! :)

chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The patch in #19 does not apply to the latest 7.x-4.x-dev so it will need a reroll.

Checking patch includes/webform.emails.inc...
Checking patch includes/webform.submissions.inc...
error: while searching for:
      $email['email'] = implode(',', $addresses);
    }

    // Generate the list of addresses that this e-mail will be sent to.
    $addresses_final = array_filter($addresses, 'webform_valid_email_address');

    if (!$addresses_final) {
      continue;
    }

    // Verify that this submission is not attempting to send any spam hacks.
    foreach ($addresses_final as $address) {
      if (_webform_submission_spam_check($address, $email['subject'], $email['from'], $email['headers'])) {
        watchdog('webform', 'Possible spam attempt from @remote !message',
          array('@remote' => ip_address(), '!message' => "<br />\n" . nl2br(htmlentities($email['message']))));
        drupal_set_message(t('Illegal information. Data not submitted.'), 'error');
        return FALSE;
      }
    }

error: patch failed: includes/webform.submissions.inc:320
error: includes/webform.submissions.inc: patch does not apply
Checking patch tests/WebformEmailTestCase.test...
Checking patch tests/WebformSubmissionTestCase.test...
Checking patch tests/WebformTestCase.test...
Hunk #2 succeeded at 1074 (offset 1 line).
Checking patch webform.info...
Checking patch webform.install...
error: while searching for:

  return t('Webform emails may now be disabled.');
}

error: patch failed: webform.install:2351
error: webform.install: patch does not apply
liam morland’s picture

Status: Needs work » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.