Pledge Log: Capture email events.

This commit is contained in:
Ian Dunn 2019-10-31 20:39:57 -05:00
parent 97daa42308
commit 87eb8ec43a
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB
4 changed files with 46 additions and 5 deletions

View file

@ -28,6 +28,7 @@
*/
namespace WordPressDotOrg\FiveForTheFuture\Email;
use WordPressDotOrg\FiveForTheFuture;
defined( 'WPINC' ) || die();
@ -42,17 +43,32 @@ const TOKEN_LENGTH = 32;
* @param string $to
* @param string $subject
* @param string $message
* @param int $pledge_id
*
* @return bool
*/
function send_email( $to, $subject, $message ) {
function send_email( $to, $subject, $message, $pledge_id ) {
$headers = array(
'From: WordPress - Five for the Future <donotreply@wordpress.org>',
'Reply-To: support@wordcamp.org',
// todo update address when new one is created
);
return wp_mail( $to, $subject, $message, $headers );
$result = wp_mail( $to, $subject, $message, $headers );
/**
* Broadcast the results of an attempt to send an email.
*
* @param string $to
* @param string $subject
* @param string $message
* @param array $headers
* @param bool $result
* @param int $pledge_id
*/
do_action( FiveForTheFuture\PREFIX . '_email_result', $to, $subject, $message, $headers, $result, $pledge_id );
return $result;
}
/**