summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/mail.php3
-rw-r--r--tests/lib/mail.php9
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/mail.php b/lib/private/mail.php
index 79f51609631..f9083cc4e64 100644
--- a/lib/private/mail.php
+++ b/lib/private/mail.php
@@ -137,6 +137,9 @@ class OC_Mail {
* @return string
*/
public static function buildAsciiEmail($emailAddress) {
+ if (!function_exists('idn_to_ascii')) {
+ return $emailAddress;
+ }
list($name, $domain) = explode('@', $emailAddress, 2);
$domain = idn_to_ascii($domain);
diff --git a/tests/lib/mail.php b/tests/lib/mail.php
index a88a9d797ae..3cc9868e25e 100644
--- a/tests/lib/mail.php
+++ b/tests/lib/mail.php
@@ -8,6 +8,15 @@
class Test_Mail extends PHPUnit_Framework_TestCase {
+ protected function setUp()
+ {
+ if (!function_exists('idn_to_ascii')) {
+ $this->markTestSkipped(
+ 'The intl extension is not available.'
+ );
+ }
+ }
+
/**
* @dataProvider buildAsciiEmailProvider
* @param $expected