WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Customizing lost password email (7 posts)

  1. joelholland
    Member
    Posted 4 years ago #

    Right now when a user has their email reset, the notification is sent from WordPress (and the actual email address is wordpress@stockfootageforfree.com).

    Try as I may, I cannot figure out how to hack this to change the from name to be our blog name. Any ideas?

    I was able to get around this same problem with the registration emails using the Register Plus plugin, which works great. It let us set a custom from name and email. But it doesn't affect lost password emails, unfortunately.

    Any help would be greatly (and desperately) appreciated. Even telling me which .php file I can hack to change the default from name would be excellent.

    - Joel

  2. MichaelH
    Member
    Posted 4 years ago #

    Here's five possibilites. Not sure which will play best with Register Plus.

    http://wordpress.org/extend/plugins/wp-mailfrom/
    http://wordpress.org/extend/plugins/send-from/
    http://wordpress.org/extend/plugins/set-email-from-address/
    http://wordpress.org/extend/plugins/mail-from/
    http://wordpress.org/extend/plugins/wp-from-email/

    Interesting wp-hackers discussion: http://lists.automattic.com/pipermail/wp-hackers/2010-February/030513.html

    If you do employee one of those plugins could you reply back here so I can tag this thread with that plugins tag. Thanks.

  3. joelholland
    Member
    Posted 4 years ago #

    Thanks for the advice MichaelH! I went the hack route and followed instructions on http://core.trac.wordpress.org/ticket/5007 which identified wp-includes/pluggable.php as the file that contains the info on from name and address. Two slight changes and it now comes from our name and email. Unfortunately it will get reset on the next upgrade, but it is an easy fix.

  4. jlowry
    Member
    Posted 4 years ago #

    Thank you both! I too went the hack route, and it worked for me!

  5. miguelnetto
    Member
    Posted 4 years ago #

    -Copy the code below
    -Change yourname and yourname@host.com in the code like you want
    -Save as <any_name>.php
    -Upload to your server in /wp-content/plugins/
    -Activate the plugin
    - Done! You never will send email with sender wordpress@
    (Works fine in WP 2.9.2)

    <?php
    /**
     * @package WP Internet
     * @author Dude
     * @version 1.0
     */
    
    /*
    Plugin Name: WP Correct "wordpress" sender mail
    Plugin URI: http://somewhere.com
    Description: Change the default address that WordPress sends it&rsquo;s email from.
    Version: 1.0
    Author: Dude
    Author URI: http://somewhere.com
    Last Change: 18.02.2010 20:20:12
    */
    
    if ( !function_exists('add_action') ) {
    	header('Status: 403 Forbidden');
    	header('HTTP/1.1 403 Forbidden');
    	exit();
    }
    
    if ( !class_exists('wp_mail_from') ) {
    	class wp_mail_from {
    
    		function wp_mail_from() {
    			add_filter( 'wp_mail_from', array(&$this, 'fb_mail_from') );
    			add_filter( 'wp_mail_from_name', array(&$this, 'fb_mail_from_name') );
    		}
    
    		// new name
    		function fb_mail_from_name() {
    			$name = 'yourname';
    			// alternative the name of the blog
    			// $name = get_option('blogname');
    			$name = esc_attr($name);
    			return $name;
    		}
    
    		// new email-adress
    		function fb_mail_from() {
    			$email = 'yourname@host.com';
    			$email = is_email($email);
    			return $email;
    		}
    
    	}
    
    	$wp_mail_from = new wp_mail_from();
    }
    ?>
  6. laiph
    Member
    Posted 4 years ago #

    dude! do you know what a gift this code is???? thank you, thank you, thank you!!! works great!

  7. s0what
    Member
    Posted 3 years ago #

    Is there a way to customize message which is sent, not only email address?

Topic Closed

This topic has been closed to new replies.

About this Topic