Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 7 years ago

#6930 closed enhancement (maybelater)

Send emails async

Reported by: djpaul's profile DJPaul Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Emails Keywords: trac-tidy-2018
Cc: espellcaste@…

Description

Let's enhance class BP_PHPMailer to send emails async; otherwise, each email sent slows down page loading. @r-a-y mentioned this idea in a comment of an old email ticket, and with my effort in 2.5 for the email API changes, here's what I'd suggest we do to achieve this:

  • Update BP_PHPMailer->bp_email() and move the $phpmailer->Send() lines into a helper method, let's call it send(). Call this method, obviously.
  • Create a new subclass and re-declare send() -- instead of sending the email, somehow grab all the properties from the email object and the delivery class as necessary, and store that data in a temporary object somewhere -- probably a site option.
  • Implement a new WP cron hook that fetches all these options from the database, re-populate the various objects, and sends the email. Send a POST request off in BP_PHPMailer_Subclass->send() to trigger the cron.
  • Update filter bp_send_email_delivery_class to use the new subclass.

Attachments (1)

6930.wp-async-task-example.patch (12.7 KB) - added by r-a-y 9 years ago.

Download all attachments as: .zip

Change History (7)

#1 @r-a-y
9 years ago

I was thinking we would use this existing WP async library by TechCrunch:
https://github.com/techcrunch/wp-async-task

This handles a lot of the grunt work with offsetting tasks to another page load.

6930.wp-async-task-example.patch is an example replacing the activity mentions sending code to run asynchronously with the WP_Async_Task class.

Note: This will break unit tests depending on the mention firing code to run synchronously. I haven't looked into fixing them up yet.

Version 1, edited 9 years ago by r-a-y (previous) (next) (diff)

#2 @espellcaste
9 years ago

  • Cc espellcaste@… added

This ticket was mentioned in Slack in #buddypress by r-a-y. View the logs.


8 years ago

#4 @dcavins
8 years ago

@r-a-y pointed out to me that the excellent new plugin by @thebrandonallen uses the WP Async library: https://wordpress.org/plugins/bp-emails-for-bbp/

I think that sending emails asynchronously is a great idea. :)

#5 @DJPaul
7 years ago

  • Keywords trac-tidy-2018 added

We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.

Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.

If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.

For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/

#6 @DJPaul
7 years ago

  • Milestone Awaiting Contributions deleted
  • Resolution set to maybelater
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.