Index: trunk/phase3/includes/UserMailer.php |
— | — | @@ -154,39 +154,36 @@ |
155 | 155 | * @return Status object |
156 | 156 | */ |
157 | 157 | public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = 'text/plain; charset=UTF-8' ) { |
158 | | - global $wgSMTP, $wgEnotifImpersonal; |
159 | | - global $wgEnotifMaxRecips, $wgAdditionalMailParams; |
| 158 | + global $wgSMTP, $wgEnotifMaxRecips, $wgAdditionalMailParams; |
160 | 159 | |
161 | | - $emails = ''; |
162 | | - wfDebug( __METHOD__ . ': sending mail to ' . ( is_array( $to ) ? implode( ', ', $to ) : $to ) . "\n" ); |
| 160 | + if ( !is_array( $to ) ) { |
| 161 | + $to = array( $to ); |
| 162 | + } |
163 | 163 | |
164 | | - $headers['From'] = $from->toString(); |
165 | | - $headers['Return-Path'] = $from->toString(); |
| 164 | + wfDebug( __METHOD__ . ': sending mail to ' . implode( ', ', $to ) . "\n" ); |
166 | 165 | |
167 | 166 | $dest = array(); |
168 | | - if ( is_array( $to ) ) { |
169 | | - foreach ( $to as $u ) { |
170 | | - if ( $u->address ) { |
171 | | - $dest[] = $u->address; |
172 | | - } |
| 167 | + foreach ( $to as $u ) { |
| 168 | + if ( $u->address ) { |
| 169 | + $dest[] = $u->address; |
173 | 170 | } |
174 | | - } else if( $to->address ) { |
175 | | - $dest[] = $to->address; |
176 | 171 | } |
177 | 172 | if ( count( $dest ) == 0 ) { |
178 | 173 | return Status::newFatal( 'user-mail-no-addy' ); |
179 | 174 | } |
180 | 175 | |
181 | | - if ( $wgEnotifImpersonal ) { |
| 176 | + $headers['From'] = $from->toString(); |
| 177 | + $headers['Return-Path'] = $from->address; |
| 178 | + if ( count( $to ) == 1 ) { |
| 179 | + $headers['To'] = $to[0]->toString(); |
| 180 | + } else { |
182 | 181 | $headers['To'] = 'undisclosed-recipients:;'; |
183 | 182 | } |
184 | | - else { |
185 | | - $headers['To'] = implode( ", ", $dest ); |
186 | | - } |
187 | 183 | |
188 | 184 | if ( $replyto ) { |
189 | 185 | $headers['Reply-To'] = $replyto->toString(); |
190 | 186 | } |
| 187 | + |
191 | 188 | $headers['Subject'] = self::quotedPrintable( $subject ); |
192 | 189 | $headers['Date'] = date( 'r' ); |
193 | 190 | $headers['MIME-Version'] = '1.0'; |