Skip to content

Instantly share code, notes, and snippets.

@eteubert
Created October 24, 2011 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eteubert/1309889 to your computer and use it in GitHub Desktop.
Save eteubert/1309889 to your computer and use it in GitHub Desktop.
ericteubert: ~/Sites/wordpress-single
➜ awk 'NR >= 271 && NR <= 514' wp-includes/pluggable.php | grep apply_filters
extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
$phpmailer->From = apply_filters( 'wp_mail_from' , $from_email );
$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
$content_type = apply_filters( 'wp_mail_content_type', $content_type );
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
ericteubert: ~/Sites/wordpress-single
➜ ack "function wp_mail"
wp-includes/pluggable.php
271:function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
<?php
function set_mail_header_from( $from ) {
return "silence@satoripress.com";
}
add_filter( 'wp_mail_from', 'set_mail_header_from' );
function set_mail_header_from_name( $from_name ) {
return "SATORIPRESS | Random WordPress Insights";
}
add_filter( 'wp_mail_from_name', 'set_mail_header_from_name' );
<?php
add_filter( 'wp_mail_from', function ( $from ) {
return "silence@satoripress.com";
} );
add_filter( 'wp_mail_from_name', function ( $from_name ) {
return "SATORIPRESS | Random WordPress Insights";
} );
<?php
/**
* Send mail, similar to PHP's mail
*
* [...]
*
* @uses apply_filters() Calls 'wp_mail' hook on an array of all of the parameters.
* @uses apply_filters() Calls 'wp_mail_from' hook to get the from email address.
* @uses apply_filters() Calls 'wp_mail_from_name' hook to get the from address name.
* @uses apply_filters() Calls 'wp_mail_content_type' hook to get the email content type.
* @uses apply_filters() Calls 'wp_mail_charset' hook to get the email charset
* @uses do_action_ref_array() Calls 'phpmailer_init' hook on the reference to
* phpmailer object.
*
* [...]
*
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment