Created
November 15, 2024 18:14
-
-
Save hivepress/2f4f99451d1781300651eb6e2f7e038b to your computer and use it in GitHub Desktop.
Send a copy of each new message to a custom email address #hivepress #messages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( | |
'hivepress/v1/emails/message_send/send', | |
function( $email ) { | |
$tokens = $email->get_tokens(); | |
$subject = 'Message from ' . $tokens['sender']->get_username() . ' to ' . $tokens['recipient']->get_username(); | |
$body = $tokens['message']->get_text(); | |
wp_mail( 'messages@example.com', $subject, $body ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment