From 1059a4108a91875ec13d0966e4b7ecd4a60a9fd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Philippe=20Gu=C3=A9rard?=
 <jean-philippe.guerard@tigreraye.org>
Date: Mon, 9 Jan 2012 01:55:07 +0100
Subject: [PATCH] Make it work if To is only an address

---
 fonctions.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fonctions.php b/fonctions.php
index c4f3ada6..c601097a 100644
--- a/fonctions.php
+++ b/fonctions.php
@@ -173,8 +173,12 @@ function sendEmail( $to, $subject, $body, $headers, $param)
 
   foreach ( $to_list as $one ) {
     if ( $first == 0 ) $to .= ',' ;
-    $to_cut = explode( '<' ,$one, 2 ) ;
-    $to .= '=?UTF-8?B?' . base64_encode( $to_cut[ 0 ] ) . '?= <' . $to_cut[ 1 ] ;
+    if ( preg_match( "/</", $one ) ) {
+      $to_cut = explode( '<' ,$one ) ;
+      $to .= '=?UTF-8?B?' . base64_encode( $to_cut[ 0 ] ) . '?= <' . $to_cut[ 1 ] ;
+    } else {
+      $to .= $one ;
+    }
     $first = 0 ;
   } ;
 
-- 
GitLab