Plugin to change the WP Email sender details and fix html entities

if you want to change the default sender in the WP core this can be easily plugged.
Equally it’s easy to fix html entitites being transmitted as their encoded literals in the email subjects.

This code shows you how

Plugin Name: Change Email From Address/Name
Plugin URI:
Description: changes the email from address
Version: 0.1.0
Author: Justin Adie
Author URI:
class emailFrom{
	public function __construct(){
		add_filter('wp_mail_from', array(&$this, 'doEmailFilter'),10, 1);
		add_filter('wp_mail_from_name', array(&$this, 'doEmailNameFilter'), 10, 1);
		add_filter('wp_mail_charset',array(&$this, 'fixCharset'), 10, 1);
		add_filter('wp_mail', array(&$this, 'decode'), 10,1);
	public function decode($array){
		$array['subject'] = html_entity_decode($array['subject']);
		return $array;
	public function fixCharset($data){
		return 'UTF-8';
	public function doEmailFilter($data){
		return '';
	public function doEmailNameFilter($data){
		return 'My Name';
$_ef = new emailFrom();


James John MalcolmSeptember 14th, 2009 at 5:51 pm

Works like a charm, thank you very much!

Have you thought of adding this to the WP plugins site?

nathanJanuary 1st, 2010 at 1:52 pm

how are you? great tool! I would like to know is it possible for me to get the user’s email address as from address instead of when a user register with my site. That is quite easier for me to add them to my “email client’s address book”
Thanks for your effort

JustinJanuary 18th, 2010 at 11:36 am


Leave a comment

Your comment