[wp-trac] Re: [WordPress Trac] #2830: Change the way t he domain is being retrieved for sending e-mails from wordpress@..

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 3 11:28:27 GMT 2006


#2830: Change the way t he domain is being retrieved for sending e-mails from
wordpress at ..
-----------------------+----------------------------------------------------
 Reporter:  Woudloper  |        Owner:  westi   
     Type:  defect     |       Status:  assigned
 Priority:  normal     |    Milestone:  2.1     
Component:  General    |      Version:  2.0.3   
 Severity:  normal     |   Resolution:          
 Keywords:             |  
-----------------------+----------------------------------------------------
Changes (by westi):

  * status:  new => assigned
  * owner:  anonymous => westi

Comment:

 I don't think this needs to be a core feature.

 A very simple plugin (untested but should work fine) can be used to
 replace the builtin wp_mail function with one that sends from another
 address:

 {{{
 /*
    Plugin Name: Override Email Address
    Description: Allows you to override the email address used by wp_mail
    Author: Peter Westwood
    Version: 0.01
    Author URI: http://blog.ftwr.co.uk/
  */

 function wp_mail($to, $subject, $message, $headers = '') {
         if( $headers == '' ) {
                 $headers = "MIME-Version: 1.0\n" .
                 "From: user at domain \n" .
                 "Content-Type: text/plain; charset=\"" .
 get_settings('blog_charset') . "\"\n";
         }

         return @mail($to, $subject, $message, $headers);
 }
 }}}

 Replacing user at domain in the above plugin and activating it will allow you
 to pick the email address you want the emails to originate from.

 This plugin works because wp_mail is one of the pluggable functions that a
 plugin can override by defining it before WordPress

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2830#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list