Created
October 24, 2011 19:19
-
-
Save eteubert/1309889 to your computer and use it in GitHub Desktop.
WordPress How To: Change the Email FROM Header | http://www.satoripress.com/2011/10/wordpress/plugin-development/change-the-email-from-header-56/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ericteubert: ~/Sites/wordpress-single | |
➜ ack "function wp_mail" | |
wp-includes/pluggable.php | |
271:function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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