X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FMail.php;h=6e7cc0c6cca89b4d6719d48b13e7826e97e61cf8;hb=19cd79d2416453dde14a6440621950f51382171d;hp=32a55757078d4388cf684d1d59ca7289f83e25e5;hpb=49cfbaed65e6920698d83b57985df1eb228479a2;p=civicrm-core.git diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index 32a5575707..6e7cc0c6cc 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -1,34 +1,18 @@ 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 +80,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 +89,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 +176,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 +217,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 +256,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 +302,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.', [ + 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE), + ]) . '

'; return $message; } @@ -432,13 +416,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 +450,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 +516,11 @@ class CRM_Utils_Mail { TRUE, $format) ); - return array( + return [ 'fullPath' => $pdf_filename, 'mime_type' => 'application/pdf', 'cleanName' => $fileName, - ); + ]; } /** @@ -553,7 +537,7 @@ class CRM_Utils_Mail { $formattedEmail = $fields['email']; } - $formattedSuffix = array(); + $formattedSuffix = []; if (!empty($fields['is_bulkmail'])) { $formattedSuffix[] = '(' . ts('Bulk') . ')'; }