Index: trunk/phase3/includes/UserMailer.php |
— | — | @@ -180,19 +180,28 @@ |
181 | 181 | set_error_handler( 'mailErrorHandler' ); |
182 | 182 | wfDebug( "Sending mail via internal mail() function\n" ); |
183 | 183 | |
184 | | - if (is_array($to)) |
185 | | - foreach ($to as $recip) |
186 | | - mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers ); |
| 184 | + if (function_exists('mail')) |
| 185 | + if (is_array($to)) |
| 186 | + foreach ($to as $recip) |
| 187 | + $sent = mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers ); |
| 188 | + else |
| 189 | + $sent = mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers ); |
187 | 190 | else |
188 | | - mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers ); |
| 191 | + $wgErrorString = 'PHP is not configured to send mail'; |
189 | 192 | |
| 193 | + |
190 | 194 | restore_error_handler(); |
191 | 195 | |
192 | 196 | if ( $wgErrorString ) { |
193 | 197 | wfDebug( "Error sending mail: $wgErrorString\n" ); |
| 198 | + return $wgErrorString; |
| 199 | + } elseif (! $sent) { |
| 200 | + //mail function only tells if there's an error |
| 201 | + wfDebug( "Error sending mail\n" ); |
| 202 | + return 'mailer error'; |
| 203 | + } else { |
| 204 | + return ''; |
194 | 205 | } |
195 | | - return $wgErrorString; |
196 | | - } |
197 | 206 | } |
198 | 207 | |
199 | 208 | /** |