jacobwb / hashover-next

This branch will be HashOver 2.0
GNU Affero General Public License v3.0
420 stars 87 forks source link

Email notifications not working by some language. And fix it. #268

Closed icandura closed 5 years ago

icandura commented 5 years ago

Hello, I updated the new version of hashover-next because of changing the VPS. I found that the email notifications is not working on new VPS. Btw, my old VPS is Ubuntu, and new VPS is Debian.

After a few days of testing, I finally found out that the problem is the language. I set the language to Japanese, Korean and Chinese. The email notifications not working. I set the language to English, French and Spanish. The email notifications working.

I solved this problem by modifying "Sendmail.php" At the end of this file, add a line before calling the mail() function.

// Send mail
mail ($this->to, $this->subject, $message, $headers);

// Send mail
$this->subject = "=?UTF-8?B?".base64_encode($this->subject)."?=";
mail ($this->to, $this->subject, $message, $headers);

Then it works for me.

Btw, my old VPS is Ubuntu, and new VPS is Debian. I tested hashover-next on Ubuntu and CentOS respectively. There is no such problem. Maybe this problem is only in some systems.

jacobwb commented 5 years ago

Thank you very much for pointing out this issue. While HashOver supports multiple languages, I do not speak anything other than English, so other languages don't always get as much testing as English. It is always great to get input like this from people who use HashOver in different languages.

This should now be fixed. PHP has built-in functionality for this kind of encoding, so I now use it for the subject. I have also went ahead and set the emails to be sent in quoted-printable encoding to support multiple languages + emojis, this hopefully generalizes the email content enough that HashOver will work out-of-the-box on more server setups.

Please let me know if the new code works for you.

If it does, please close this issue.