You are here

public function DrupalPHPMailer::SetLanguage in PHPMailer 8.3

Provide more user-friendly error messages.

Note: messages should not end with a dot.

File

src/Plugin/Mail/DrupalPHPMailer.php, line 196

Class

DrupalPHPMailer
Implements the base PHPMailer class for the Drupal MailInterface.

Namespace

Drupal\phpmailer\Plugin\Mail

Code

public function SetLanguage($langcode = 'en', $lang_path = 'language/') {

  // Retrieve English defaults to ensure all message keys are set.
  parent::SetLanguage('en');

  // Overload with Drupal translations.
  $this->language = [
    'authenticate' => t('SMTP error: Could not authenticate.'),
    'connect_host' => t('SMTP error: Could not connect to host.'),
    'data_not_accepted' => t('SMTP error: Data not accepted.'),
    'smtp_connect_failed' => t('SMTP error: Could not connect to SMTP host.'),
    'smtp_error' => t('SMTP server error: '),
    // Messages used during email generation.
    'empty_message' => t('Message body empty'),
    'encoding' => t('Unknown encoding: '),
    'variable_set' => t('Cannot set or reset variable: '),
    'file_access' => t('File error: Could not access file: '),
    'file_open' => t('File error: Could not open file: '),
    // Non-administrative messages.
    'from_failed' => t('The following From address failed: '),
    'invalid_address' => t('Invalid address'),
    'provide_address' => t('You must provide at least one recipient e-mail address.'),
    'recipients_failed' => t('The following recipients failed: '),
  ] + $this->language;
  return TRUE;
}