Changeset 5700 for trunk/wp-includes/pluggable.php
- Timestamp:
- 06/14/2007 02:25:30 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/pluggable.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pluggable.php
r5683 r5700 160 160 function wp_mail( $to, $subject, $message, $headers = '' ) { 161 161 global $phpmailer; 162 162 163 163 // (Re)create it, if it's gone missing 164 164 if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { … … 167 167 $phpmailer = new PHPMailer(); 168 168 } 169 169 170 170 // Compact the input, apply the filters, and extract them back out 171 171 extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers' ) ) ); 172 172 173 173 // Default headers 174 174 if ( empty( $headers ) ) { … … 181 181 $tempheaders = (array) explode( "\n", $headers ); 182 182 $headers = array(); 183 183 184 184 // If it's actually got contents 185 185 if ( !empty( $tempheaders ) ) { … … 188 188 // Explode them out 189 189 list( $name, $content ) = explode( ':', trim( $header ), 2 ); 190 190 191 191 // Cleanup crew 192 192 $name = trim( $name ); 193 193 $content = trim( $content ); 194 194 195 195 // Mainly for legacy -- process a From: header if it's there 196 196 if ( $name == 'From' ) { … … 200 200 $from_name = str_replace( '"', '', $from_name ); 201 201 $from_name = trim( $from_name ); 202 202 203 203 $from_email = substr( $content, strpos( '<', $content ) + 1 ); 204 204 $from_email = str_replace( '>', '', $from_email ); … … 222 222 } 223 223 } 224 224 225 225 // Empty out the values that may be set 226 226 $phpmailer->ClearAddresses(); … … 231 231 $phpmailer->ClearCustomHeaders(); 232 232 $phpmailer->ClearReplyTos(); 233 233 234 234 // From email and name 235 235 // If we don't have a name from the input headers … … 237 237 $from_name = 'WordPress'; 238 238 } 239 239 240 240 // If we don't have an email from the input headers 241 241 if ( !isset( $from_email ) ) { … … 245 245 $sitename = substr( $sitename, 4 ); 246 246 } 247 247 248 248 $from_email = 'wordpress@' . $sitename; 249 249 } 250 250 251 251 // Set the from name and email 252 252 $phpmailer->From = apply_filters( 'wp_mail_from', $from_email ); 253 253 $phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name ); 254 254 255 255 // Set destination address 256 256 $phpmailer->AddAddress( $to ); 257 257 258 258 // Set mail's subject and body 259 259 $phpmailer->Subject = $subject; 260 260 $phpmailer->Body = $message; 261 261 262 262 // Set to use PHP's mail() 263 263 $phpmailer->IsMail(); 264 264 265 265 // Set Content-Type and charset 266 266 // If we don't have a content-type from the input headers … … 268 268 $content_type = 'text/plain'; 269 269 } 270 270 271 271 // Set whether it's plaintext or not, depending on $content_type 272 272 if ( $content_type == 'text/html' ) { … … 275 275 $phpmailer->IsHTML( false ); 276 276 } 277 277 278 278 // If we don't have a charset from the input headers 279 279 if ( !isset( $charset ) ) { 280 280 $charset = get_bloginfo( 'charset' ); 281 281 } 282 282 283 283 // Set the content-type and charset 284 284 $phpmailer->ContentType = apply_filters( 'wp_mail_content_type', 'text/plain' ); 285 285 $phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset ); 286 286 287 287 // Set custom headers 288 288 if ( !empty( $headers ) ) { … … 291 291 } 292 292 } 293 293 294 294 do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); 295 295 296 296 // Send! 297 297 $result = @$phpmailer->Send(); 298 298 299 299 return $result; 300 300 } … … 534 534 535 535 @wp_mail($user->user_email, $subject, $notify_message, $message_headers); 536 536 537 537 return true; 538 538 } … … 550 550 if( get_option( "moderation_notify" ) == 0 ) 551 551 return true; 552 552 553 553 $comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1"); 554 554 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID='$comment->comment_post_ID' LIMIT 1");
Note: See TracChangeset
for help on using the changeset viewer.