diff --git a/webfiori/email/EmailMessage.php b/webfiori/email/EmailMessage.php index e86467f..e27ebc5 100644 --- a/webfiori/email/EmailMessage.php +++ b/webfiori/email/EmailMessage.php @@ -52,13 +52,6 @@ class EmailMessage { * @since 2.0 */ private $boundry; - /** - * - * @var string - * - * @since 1.0.5 - */ - private $contentLang; /** * * @var HTMLDoc @@ -350,7 +343,7 @@ public function getDocument() : HTMLDoc { * @since 1.0.5 */ public function getLang() { - return $this->contentLang; + return $this->getDocument()->getLanguage(); } /** * Returns an array that contains log messages which are generated @@ -533,6 +526,27 @@ public function send() { throw new SMTPException('Unable to login to SMTP server: '.$server->getLastResponse(), $server->getLastResponseCode()); } } + /** + * Sets the display language of the email. + * + * The length of the given string must be 2 characters in order to set the + * language code. + * + * @param string $langCode a two characters language code such as AR or EN. Default + * value is 'EN'. + * + */ + public function setLang(string $langCode = 'EN') : bool { + $langU = strtoupper(trim($langCode)); + + if (strlen($langU) == 2) { + $this->getDocument()->setLanguage($langU); + + return true; + } + + return false; + } /** * Sets the priority of the message. *