Projet

Général

Profil

Révision 8d02775b

Ajouté par Assos Assos il y a environ 4 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/webform/includes/webform.submissions.inc
231 231
 * @param $emails
232 232
 *   (optional) An array of specific e-mail settings to be used. If omitted, all
233 233
 *   e-mails in $node->webform['emails'] will be sent.
234
 * @param bool $send_disabled
235
 *   (optional) When TRUE, send all emails, even those that are disabled.
234 236
 *
235 237
 * @return int
236 238
 *   Number of mail sent.
237 239
 */
238
function webform_submission_send_mail($node, $submission, $emails = NULL) {
240
function webform_submission_send_mail($node, $submission, $emails = NULL, $send_disabled = FALSE) {
239 241
  // Get the list of e-mails we'll be sending.
240 242
  $emails = isset($emails) ? $emails : $node->webform['emails'];
241 243

  
242 244
  // Create a themed message for mailing.
243 245
  $send_count = 0;
244 246
  foreach ($emails as $eid => $email) {
247
    if (!$send_disabled && !$email['status']) {
248
      continue;
249
    }
245 250
    $mail = _webform_submission_prepare_mail($node, $submission, $email);
246 251
    if (!$mail) {
247 252
      continue;
......
280 285
function _webform_submission_prepare_mail($node, $submission, &$email) {
281 286
  global $user;
282 287

  
283
  // Don't process disabled emails.
284
  if (!$email['status']) {
285
    return;
286
  }
287

  
288 288
  // Set the HTML property based on availablity of MIME Mail.
289 289
  $email['html'] = ($email['html'] && webform_variable_get('webform_email_html_capable'));
290 290

  
......
331 331
                        '!name' => strlen($email_parts['name']) ? $email_parts['name'] : $email_parts['address'],
332 332
                        '!site_name' => $default_from_name,
333 333
                      ));
334
      $from_name = str_replace('"', "'", $from_name);
334 335
      $from_name = implode(' ', array_map('mime_header_encode', explode(' ', $from_name)));
335 336
      $email['from'] = '"' . $from_name . '" <' . $email['from'] . '>';
336 337
    }
......
617 618
      $emails[] = $form['#node']->webform['emails'][$eid];
618 619
    }
619 620
  }
620
  $sent_count = webform_submission_send_mail($node, $submission, $emails);
621
  $sent_count = webform_submission_send_mail($node, $submission, $emails, TRUE);
621 622
  if ($sent_count) {
622 623
    drupal_set_message(format_plural($sent_count,
623 624
      'Successfully re-sent submission #@sid to 1 recipient.',

Formats disponibles : Unified diff