[wp-trac] [WordPress Trac] #14710: PHPMailer class can cause an already declared error if including wp-config in an external script

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 27 10:31:57 UTC 2010


#14710: PHPMailer class can cause an already declared error if including wp-config
in an external script
-----------------------------+----------------------------------------------
 Reporter:  teamplaylotto    |       Owner:                  
     Type:  feature request  |      Status:  new             
 Priority:  normal           |   Milestone:  Awaiting Review 
Component:  Mail             |     Version:  3.0.1           
 Severity:  normal           |    Keywords:  phpmailer, class
-----------------------------+----------------------------------------------

Comment(by hakre):

 {{{wp_mail()}}}, the function which takes care of the include of {{{/wp-
 includes/class-phpmailer.php}}}, is a so called plugable function.

 You can replace it with your own implementation that takes care to not
 load phpmailer a second time.

 Additionally and more easily than writing your own mail function, you can
 hook into {{{wp_mail}}} filter and execute {{{$GLOBALS['phpmailer'] = new
 PHPMailer();}}}. That will prevent wordpress to include the file {{{/wp-
 includes/class-phpmailer.php}}}.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14710#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list