X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FMail.php;h=ca7526bf37a314ceb0f769fddc7690c58c910b71;hb=b2c9a0e36dd10d388b6ea0cab6afdc6e253119d0;hp=32a55757078d4388cf684d1d59ca7289f83e25e5;hpb=d2118be269bed42c1398dd8c4da996caeaed6006;p=civicrm-core.git diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index 32a5575707..ca7526bf37 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -48,12 +48,12 @@ class CRM_Utils_Mail { if ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB || (defined('CIVICRM_MAILER_SPOOL') && CIVICRM_MAILER_SPOOL) ) { - $mailer = self::_createMailer('CRM_Mailing_BAO_Spool', array()); + $mailer = self::_createMailer('CRM_Mailing_BAO_Spool', []); } elseif ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_SMTP) { if ($mailingInfo['smtpServer'] == '' || !$mailingInfo['smtpServer']) { - CRM_Core_Error::debug_log_message(ts('There is no valid smtp server setting. Click Administer >> System Setting >> Outbound Email to set the SMTP Server.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); - CRM_Core_Error::fatal(ts('There is no valid smtp server setting. Click Administer >> System Setting >> Outbound Email to set the SMTP Server.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); + CRM_Core_Error::debug_log_message(ts('There is no valid smtp server setting. Click Administer >> System Setting >> Outbound Email to set the SMTP Server.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); + CRM_Core_Error::fatal(ts('There is no valid smtp server setting. Click Administer >> System Setting >> Outbound Email to set the SMTP Server.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); } $params['host'] = $mailingInfo['smtpServer'] ? $mailingInfo['smtpServer'] : 'localhost'; @@ -96,8 +96,8 @@ class CRM_Utils_Mail { if ($mailingInfo['sendmail_path'] == '' || !$mailingInfo['sendmail_path'] ) { - CRM_Core_Error::debug_log_message(ts('There is no valid sendmail path setting. Click Administer >> System Setting >> Outbound Email to set the sendmail server.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); - CRM_Core_Error::fatal(ts('There is no valid sendmail path setting. Click Administer >> System Setting >> Outbound Email to set the sendmail server.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); + CRM_Core_Error::debug_log_message(ts('There is no valid sendmail path setting. Click Administer >> System Setting >> Outbound Email to set the sendmail server.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); + CRM_Core_Error::fatal(ts('There is no valid sendmail path setting. Click Administer >> System Setting >> Outbound Email to set the sendmail server.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); } $params['sendmail_path'] = $mailingInfo['sendmail_path']; $params['sendmail_args'] = $mailingInfo['sendmail_args']; @@ -105,19 +105,19 @@ class CRM_Utils_Mail { $mailer = self::_createMailer('sendmail', $params); } elseif ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MAIL) { - $mailer = self::_createMailer('mail', array()); + $mailer = self::_createMailer('mail', []); } elseif ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MOCK) { - $mailer = self::_createMailer('mock', array()); + $mailer = self::_createMailer('mock', []); } elseif ($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED) { - CRM_Core_Error::debug_log_message(ts('Outbound mail has been disabled. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); - CRM_Core_Error::statusBounce(ts('Outbound mail has been disabled. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); + CRM_Core_Error::debug_log_message(ts('Outbound mail has been disabled. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); + CRM_Core_Error::statusBounce(ts('Outbound mail has been disabled. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); } else { - CRM_Core_Error::debug_log_message(ts('There is no valid SMTP server Setting Or SendMail path setting. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); + CRM_Core_Error::debug_log_message(ts('There is no valid SMTP server Setting Or SendMail path setting. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); CRM_Core_Error::debug_var('mailing_info', $mailingInfo); - CRM_Core_Error::statusBounce(ts('There is no valid SMTP server Setting Or sendMail path setting. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')))); + CRM_Core_Error::statusBounce(ts('There is no valid SMTP server Setting Or sendMail path setting. Click Administer >> System Setting >> Outbound Email to set the OutBound Email.', [1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1')])); } return $mailer; } @@ -192,7 +192,7 @@ class CRM_Utils_Mail { $htmlMessage = FALSE; } - $headers = array(); + $headers = []; // CRM-10699 support custom email headers if (!empty($params['headers'])) { $headers = array_merge($headers, $params['headers']); @@ -233,7 +233,7 @@ class CRM_Utils_Mail { } // make sure we has to have space, CRM-6977 - foreach (array('From', 'To', 'Cc', 'Bcc', 'Reply-To', 'Return-Path') as $fld) { + foreach (['From', 'To', 'Cc', 'Bcc', 'Reply-To', 'Return-Path'] as $fld) { if (isset($headers[$fld])) { $headers[$fld] = str_replace('"<', '" <', $headers[$fld]); } @@ -272,7 +272,7 @@ class CRM_Utils_Mail { $message = self::setMimeParams($msg); $headers = $msg->headers($headers); - $to = array($params['toEmail']); + $to = [$params['toEmail']]; $result = NULL; $mailer = \Civi::service('pear_mail'); @@ -318,9 +318,9 @@ class CRM_Utils_Mail { * @return string */ public static function errorMessage($mailer, $result) { - $message = '
' . ts('An error occurred when CiviCRM attempted to send an email (via %1). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.', array( - 1 => 'SMTP', - )) . '
' . '' . ts('The mail library returned the following error message:') . '
' . $result->getMessage() . '
' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '
'; + $message = '' . ts('An error occurred when CiviCRM attempted to send an email (via %1). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.', [ + 1 => 'SMTP', + ]) . '
' . '' . ts('The mail library returned the following error message:') . '
' . $result->getMessage() . '
' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '
'; if (is_a($mailer, 'Mail_smtp')) { $message .= '' . ts('Check this page for more information.', array( - 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE), - )) . '
'; + $message .= '' . ts('Check this page for more information.', [ + 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE), + ]) . '
'; return $message; } @@ -432,13 +432,13 @@ class CRM_Utils_Mail { static $mimeParams = NULL; if (!$params) { if (!$mimeParams) { - $mimeParams = array( + $mimeParams = [ 'text_encoding' => '8bit', 'html_encoding' => '8bit', 'head_charset' => 'utf-8', 'text_charset' => 'utf-8', 'html_charset' => 'utf-8', - ); + ]; } $params = $mimeParams; } @@ -466,8 +466,8 @@ class CRM_Utils_Mail { if (!empty($name)) { // escape the special characters - $name = str_replace(array('<', '"', '>'), - array('\<', '\"', '\>'), + $name = str_replace(['<', '"', '>'], + ['\<', '\"', '\>'], $name ); if (strpos($name, ',') !== FALSE || @@ -532,11 +532,11 @@ class CRM_Utils_Mail { TRUE, $format) ); - return array( + return [ 'fullPath' => $pdf_filename, 'mime_type' => 'application/pdf', 'cleanName' => $fileName, - ); + ]; } /** @@ -553,7 +553,7 @@ class CRM_Utils_Mail { $formattedEmail = $fields['email']; } - $formattedSuffix = array(); + $formattedSuffix = []; if (!empty($fields['is_bulkmail'])) { $formattedSuffix[] = '(' . ts('Bulk') . ')'; }