Index: trunk/phase3/includes/UserMailer.php |
— | — | @@ -143,11 +143,22 @@ |
144 | 144 | $headers['From'] = $from->toString(); |
145 | 145 | $headers['Return-Path'] = $from->toString(); |
146 | 146 | |
| 147 | + $dest = array(); |
| 148 | + if ( is_array( $to ) ) { |
| 149 | + foreach ( $to as $u ) { |
| 150 | + if ( $u->address ) { |
| 151 | + $dest[] = $u->address; |
| 152 | + } |
| 153 | + } |
| 154 | + } else if( $to->address ) { |
| 155 | + $dest[] = $to->address; |
| 156 | + } |
| 157 | + |
147 | 158 | if ( $wgEnotifImpersonal ) { |
148 | 159 | $headers['To'] = 'undisclosed-recipients:;'; |
149 | 160 | } |
150 | 161 | else { |
151 | | - $headers['To'] = implode( ", ", (array )$dest ); |
| 162 | + $headers['To'] = implode( ", ", $dest ); |
152 | 163 | } |
153 | 164 | |
154 | 165 | if ( $replyto ) { |
— | — | @@ -180,15 +191,6 @@ |
181 | 192 | $msgid .= '.' . posix_getpid(); |
182 | 193 | } |
183 | 194 | |
184 | | - if ( is_array( $to ) ) { |
185 | | - $dest = array(); |
186 | | - foreach ( $to as $u ) { |
187 | | - $dest[] = $u->address; |
188 | | - } |
189 | | - } else { |
190 | | - $dest = $to->address; |
191 | | - } |
192 | | - |
193 | 195 | wfSuppressWarnings(); |
194 | 196 | |
195 | 197 | // Create the mail object using the Mail::factory method |
— | — | @@ -199,8 +201,8 @@ |
200 | 202 | return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() ); |
201 | 203 | } |
202 | 204 | |
203 | | - wfDebug( "Sending mail via PEAR::Mail to $dest\n" ); |
204 | | - $chunks = array_chunk( (array)$dest, $wgEnotifMaxRecips ); |
| 205 | + wfDebug( "Sending mail via PEAR::Mail\n" ); |
| 206 | + $chunks = array_chunk( $dest, $wgEnotifMaxRecips ); |
205 | 207 | foreach ( $chunks as $chunk ) { |
206 | 208 | $status = self::sendWithPear( $mail_object, $chunk, $headers, $body ); |
207 | 209 | if ( !$status->isOK() ) { |
— | — | @@ -244,7 +246,7 @@ |
245 | 247 | return Status::newFatal( 'php-mail-error', self::$mErrorString ); |
246 | 248 | } elseif ( ! $sent ) { |
247 | 249 | // mail function only tells if there's an error |
248 | | - wfDebug( "Error sending mail\n" ); |
| 250 | + wfDebug( "Unknown error sending mail\n" ); |
249 | 251 | return Status::newFatal( 'php-mail-error-unknown' ); |
250 | 252 | } else { |
251 | 253 | return Status::newGood(); |