summaryrefslogtreecommitdiffstats
path: root/lib/private/mail.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/mail.php')
-rw-r--r--lib/private/mail.php17
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";
+ }
+
}