[buddypress-trac] [BuddyPress Trac] #7286: BP Email: Allow end user to specify which PHPMailer should be used.

buddypress-trac noreply at wordpress.org
Tue Nov 8 10:11:26 UTC 2016


#7286: BP Email: Allow end user to specify which PHPMailer should be used.
-------------------------+--------------------
 Reporter:  dcavins      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  2.8
Component:  Emails       |     Version:  2.5.0
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+--------------------

Comment (by DJPaul):

 To loop back. I've recently read "Modernizing Legacy Applications in PHP"
 by Paul Jones (on Lulu.com) which introduced me to the concept of
 Dependency Injection and how to migrate legacy code to modern practices
 and techniques. I want to use `BP_PHPMailer` as a guinea pig for trying
 out some of this. The change we should make is actually very simple:

 Add constructor to `BP_PHPMailer`, and pass in PHPMailer object. Store it
 as a new property on the class. Remove the existing `static` variable.

  * Key thing is to create the `PHPMailer` object outside the class and
 push it in ("dependency '''In'''jection").

 We'd add the filter for the class name of the PHPMailer object outside the
 class, inside the `bp_send_email` function, just before we create the
 `BP_PHPMailer` class. We can reuse 99% of @dcavins' first patch for this.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7286#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list