Make it work if To is only an address

This commit is contained in:
Jean-Philippe Guérard 2012-01-09 01:55:07 +01:00
parent 848dcc5370
commit 1059a4108a
1 changed files with 6 additions and 2 deletions

View File

@ -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 ;
} ;