diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-24 13:46:31 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-24 13:46:31 +0100 |
commit | fb7f3008d33cb123f8b6931f6edf8697913b355a (patch) | |
tree | 0dc278b23ca5f050a25a89256be4c56c146ae909 /lib/private/mail.php | |
parent | abdc823bb69600c3a4fc23e09f9de5819b57f56e (diff) | |
download | nextcloud-server-fb7f3008d33cb123f8b6931f6edf8697913b355a.tar.gz nextcloud-server-fb7f3008d33cb123f8b6931f6edf8697913b355a.zip |
idn have to be converted before being used
Diffstat (limited to 'lib/private/mail.php')
-rw-r--r-- | lib/private/mail.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/mail.php b/lib/private/mail.php index 9605290fe57..f691fda979d 100644 --- a/lib/private/mail.php +++ b/lib/private/mail.php @@ -73,6 +73,7 @@ class OC_Mail { $mailo->FromName = $fromname;; $mailo->Sender = $fromaddress; try { + $toaddress = self::buildAsciiEmail($toaddress); $mailo->AddAddress($toaddress, $toname); if($ccaddress<>'') $mailo->AddCC($ccaddress, $ccname); @@ -125,6 +126,22 @@ class OC_Mail { * @return bool */ public static function ValidateAddress($emailAddress) { + $emailAddress = self::buildAsciiEmail($emailAddress); return PHPMailer::ValidateAddress($emailAddress); } + + /** + * IDN domains will be properly converted to ascii domains. + * + * @param string $emailAddress + * @return string + */ + public static function buildAsciiEmail($emailAddress) { + + list($name, $domain) = explode('@', $emailAddress, 2); + $domain = idn_to_ascii($domain); + + return "$name@$domain"; + } + } |