Title: Email From header modification
Last modified: August 21, 2016

---

# Email From header modification

 *  Resolved [qwertysimo](https://wordpress.org/support/users/qwertysimo/)
 * (@qwertysimo)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/email-from-header-modification/)
 * If you want sent emails to have “From” address in form of “blogname <admin_email
   >”, you can modify this great plugin as follows. All changes are done in file
   new-user-approve.php.
 * **1.** Insert this code after last function in php file:
 *     ```
       public function headers() {
       		if ( empty($this->myname) || empty($this->myemail) ) {
       				$this->myname = html_entity_decode(get_option('blogname'), ENT_QUOTES);
       				$this->myemail = get_option('admin_email');
       			}
   
       		if ( function_exists('mb_encode_mimeheader') ) {
       			$header['From'] = mb_encode_mimeheader($this->myname, 'UTF-8', 'Q') . " <" . $this->myemail . ">";
       			$header['Reply-To'] = mb_encode_mimeheader($this->myname, 'UTF-8', 'Q') . " <" . $this->myemail . ">";
       		} else {
       			$header['From'] = $this->myname. " <" . $this->myemail . ">";
       			$header['Reply-To'] = $this->myname . " <" . $this->myemail . ">";
       		}
   
       		$header['Return-path'] = "<" . $this->myemail . ">";
       		$header['Content-Type'] = "text/plain; charset=\"". get_option('blog_charset') . "\"";
   
       		// collapse the headers using $key as the header name
       		foreach ( $header as $key => $value ) {
       			$headers[$key] = $key . ": " . $value;
       		}
       		$headers = implode("\n", $headers);
       		$headers .= "\n";
   
       		return $headers;
       	}
       ```
   
 * **2.** Find all occurences of code
    `wp_mail( get_option( 'admin_email' ), $subject,
   $message );` and `@wp_mail( $user_email, $subject, $message )` and change them
   to `wp_mail( get_option( 'admin_email' ), $subject, $message, $headers );` and`
   @wp_mail( $user_email, $subject, $message, $headers );` respectively.
 * **3.** Insert following code
    `$headers = $this->headers();` before all occurences
   of `wp_mail( get_option( 'admin_email' ), $subject, $message, $headers );` and`
   @wp_mail( $user_email, $subject, $message, $headers );`
 * **4.** Find this code
    `var $_admin_page = 'new-user-approve-admin';` and insert
   this code after it:
 *     ```
       var $myname = '';
       var $myemail = '';
       ```
   
 * This modification is based on code from great Subscribe2 plugin.
 * [http://wordpress.org/extend/plugins/new-user-approve/](http://wordpress.org/extend/plugins/new-user-approve/)

The topic ‘Email From header modification’ is closed to new replies.

 * ![](https://ps.w.org/new-user-approve/assets/icon-128x128.gif?rev=2544141)
 * [New User Approve](https://wordpress.org/plugins/new-user-approve/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/new-user-approve/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/new-user-approve/)
 * [Active Topics](https://wordpress.org/support/plugin/new-user-approve/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/new-user-approve/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/new-user-approve/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [qwertysimo](https://wordpress.org/support/users/qwertysimo/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/email-from-header-modification/)
 * Status: resolved