Skip to content

Commit fafb509

Browse files
author
filip
committed
Corrected welcome email encoding to utf-8
The conversion to iso-8859-1 causes compatibility problems with some languages, therefore the transition to utf-8
1 parent 75bde1b commit fafb509

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

interface/web/mail/mail_user_edit.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ function onAfterInsert() {
214214
// send a welcome email to create the mailbox
215215
// mail($this->dataRecord["email"],$app->tform->wordbook["welcome_mail_subject"],$app->tform->wordbook["welcome_mail_message"]);
216216

217+
/*
218+
// the conversion to iso-8859-1 causes compatibility problems, therefore the transition to utf-8
219+
217220
// tries to detect current charset, and encode subject-header and body from it to ISO-8859-1.
218221
$fromCharset = mb_detect_encoding($app->tform->lng("welcome_mail_subject"));
219222
$iconvPreferences = array("input-charset" => $fromCharset,
@@ -235,6 +238,22 @@ function onAfterInsert() {
235238
236239
mail($mailTarget, $mailSubject, $mailBody, $mailHeaders);
237240
241+
*/
242+
243+
$welcomeFromName = $app->tform->lng("welcome_mail_fromname_txt");
244+
$welcomeFromEmail = $app->tform->lng("welcome_mail_fromemail_txt");
245+
$mailHeaders = "MIME-Version: 1.0" . "\n";
246+
$mailHeaders .= "Content-type: text/plain; charset=utf-8" . "\n";
247+
$mailHeaders .= "Content-Transfer-Encoding: 8bit" . "\n";
248+
$mailHeaders .= "From: $welcomeFromName <$welcomeFromEmail>" . "\n";
249+
$mailHeaders .= "Reply-To: <$welcomeFromEmail>" . "\n";
250+
$mailTarget = $this->dataRecord["email"];
251+
252+
$mailSubject = "=?utf-8?Q?" . imap_8bit($app->tform->lng("welcome_mail_subject")) . "?=";
253+
$mailBody = $app->tform->lng("welcome_mail_message");
254+
255+
mail($mailTarget, $mailSubject, $mailBody, $mailHeaders);
256+
238257
// Spamfilter policy
239258
$policy_id = intval($this->dataRecord["policy"]);
240259
if($policy_id > 0) {

0 commit comments

Comments
 (0)