Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Set WP Mail Headers
- Plugin URI: http://pastebin.com/edit.php?i=WvWknrmp
- Version: 1.0
- Description: Put anything you want in the email headers.
- Author: Kenth Hagström
- Author URI: http://designpalatset.se/
- Contributors:
- License: GPL2
- License URI: http://www.opensource.org/licenses/gpl-license.php
- */
- /**
- * Set any WP Mail Parameters you'd like to
- *
- * @uses filter wp_mail
- * @param array $params
- * @return array
- */
- function dp_set_wp_mail_params( $params ) {
- $params['headers'] = '';
- $params['headers'] .= "Organization: Organisationsnamn\r\n";
- $params['headers'] .= "MIME-Version: 1.0\r\n";
- $params['headers'] .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
- $params['headers'] .= "X-Priority: 2\r\n"; // Make it less spammy
- $params['headers'] .= "X-Mailer: PHP ". phpversion() ."\r\n";
- return $params;
- }
- add_filter( 'wp_mail', 'dp_set_wp_mail_params', 5 );
- /**
- * Force Return-Path
- *
- * @param object $phpmailer
- * @return void
- */
- function dp_fix_return_path( $phpmailer ) {
- $phpmailer->Sender = $phpmailer->From;
- }
- add_action( 'phpmailer_init', 'dp_fix_return_path', 10 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement