You are here

public function DrupalPHPMailer::SetLanguage in PHPMailer 6.3

Same name and namespace in other branches
  1. 5.2 includes/phpmailer.class.inc \DrupalPHPMailer::SetLanguage()
  2. 5 includes/phpmailer.inc \DrupalPHPMailer::SetLanguage()
  3. 6 includes/phpmailer.inc \DrupalPHPMailer::SetLanguage()
  4. 6.2 includes/phpmailer.class.inc \DrupalPHPMailer::SetLanguage()
  5. 7.4 includes/phpmailer.class.inc \DrupalPHPMailer::SetLanguage()
  6. 7.3 includes/phpmailer.class.inc \DrupalPHPMailer::SetLanguage()

Provide more user-friendly error messages.

Note: messages should not end with a dot.

File

includes/phpmailer.class.inc, line 170
Implements the base PHPMailer for Drupal class.

Class

DrupalPHPMailer
Base PHPMailer for Drupal implementation with support for SMTP keep-alive and setting a custom Return-Path.

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 = array(
    '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;
}