From e99991996dbb9e7b0b0ff6cfa94dc0fb2522eb66 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 29 Sep 2010 08:36:28 -0400
Subject: [PATCH] - Add Internationalized Domain Name (IDNA) support (#1483894)

---
 program/include/rcube_smtp.php |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/program/include/rcube_smtp.php b/program/include/rcube_smtp.php
index 3c9f669..b457476 100644
--- a/program/include/rcube_smtp.php
+++ b/program/include/rcube_smtp.php
@@ -98,6 +98,9 @@
     else
       $helo_host = 'localhost';
 
+    // IDNA Support
+    $smtp_host = idn_to_ascii($smtp_host);
+
     $this->conn = new Net_SMTP($smtp_host, $smtp_port, $helo_host);
 
     if($RCMAIL->config->get('smtp_debug'))
@@ -116,10 +119,14 @@
     $smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']);
     $smtp_pass = str_replace('%p', $RCMAIL->decrypt($_SESSION['password']), $CONFIG['smtp_pass']);
     $smtp_auth_type = empty($CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type'];
-    
+
     // attempt to authenticate to the SMTP server
     if ($smtp_user && $smtp_pass)
     {
+      // IDNA Support
+      if (strpos($smtp_user, '@'))
+        $smtp_user = idn_to_ascii($smtp_user);
+
       $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls);
 
       if (PEAR::isError($result))

--
Gitblit v1.9.1