Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_mail

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
161      global $phpmailer;
162
163      if ( !is_object( $phpmailer ) ) {
164           require_once(ABSPATH . WPINC . '/class-phpmailer.php');
165           require_once(ABSPATH . WPINC . '/class-smtp.php');
166           $phpmailer = new PHPMailer();
167      }
168
169      $mail = compact('to', 'subject', 'message', 'headers');
170      $mail = apply_filters('wp_mail', $mail);
171      extract($mail);
172
173      if ( $headers == '' ) {
174           $headers = "MIME-Version: 1.0\n" .
175                "From: " . apply_filters('wp_mail_from', "wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']))) . "\n" . 
176                "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
177      }
178
179      $phpmailer->ClearAddresses();