C_mailer

C_mailer API reference

class C_mailer extends PHPMailer

Extends: PHPMailer

Source: shared/code/tce_class_mailer.php:42

Methods

setConfigData()

Copy the TCExam email configuration ($emailcfg) onto this mailer instance.

The configuration comes from a plain PHP config file, so every value is untyped as far as static analysis is concerned: cast each one to the type PHPMailer declares for the matching property. The charset falls back to the configured default when the language has none.

public setConfigData(array<array-key,mixed> $emailcfg, string $charset = ''): void

Parameters:

  • $emailcfg (array<array-key,mixed>): TCExam email configuration array.
  • $charset (string): Language charset, overrides the configured one when not empty.

Source: shared/code/tce_class_mailer.php:67

setError()

Replace the default setError to show a localized TCExam error page and stop.

public setError(mixed $msg)

Parameters:

  • $msg (mixed): (string) error message

Source: shared/code/tce_class_mailer.php:49

setLanguageData()

Load the localized mailer-error strings.

PHPMailer 7 resolves its error messages through the static self::lang()/self::$language mechanism (lang() is no longer an overridable instance method, and is always called as self::lang() internally). So instead of overriding lang(), the TCExam translations are merged onto PHPMailer’s own language keys: a TMX entry “m_mailerror_<key>” overrides PHPMailer’s “<key>” message. English defaults are loaded first so any key TCExam does not translate still resolves.

public setLanguageData(mixed $lang)

Parameters:

  • $lang (mixed): (array) TCExam language array (the global $l).

Source: shared/code/tce_class_mailer.php:112