Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init new custom mailer class #1068

Merged
merged 15 commits into from
Dec 11, 2024
Merged

Init new custom mailer class #1068

merged 15 commits into from
Dec 11, 2024

Conversation

pfefferle
Copy link
Member

@pfefferle pfefferle commented Dec 10, 2024

I forgot to load the mailer 🫣

And added some line breaks

Screenshot 2024-12-10 at 17 09 57 Screenshot 2024-12-10 at 17 10 03 Screenshot 2024-12-10 at 17 10 08 Screenshot 2024-12-10 at 17 10 12

Bonus: Direct-Messages

Fix #1012

I forgot to load the mailer

And added some line breaks
@pfefferle pfefferle requested a review from a team December 10, 2024 16:13
@pfefferle pfefferle added the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Dec 10, 2024
@pfefferle pfefferle removed the Skip Changelog Disables the "Changelog Updated" action for PRs where changelog entries are not necessary. label Dec 10, 2024
includes/class-mailer.php Outdated Show resolved Hide resolved
includes/class-mailer.php Outdated Show resolved Hide resolved
includes/class-mailer.php Outdated Show resolved Hide resolved
includes/class-mailer.php Outdated Show resolved Hide resolved
pfefferle and others added 4 commits December 10, 2024 19:15
@pfefferle pfefferle requested a review from obenland December 10, 2024 18:22
@pfefferle pfefferle requested a review from a team December 10, 2024 19:03
obenland
obenland previously approved these changes Dec 10, 2024
@pfefferle pfefferle requested a review from obenland December 11, 2024 07:26
Comment on lines +180 to 186
$message = \sprintf( \esc_html__( 'New Direct Message: %2$s', 'activitypub' ), \esc_html( get_option( 'blogname' ) ), \wp_strip_all_tags( $activity['object']['content'] ) ) . "\r\n\r\n";
/* translators: Actor name */
$message .= \sprintf( \esc_html__( 'From: %s', 'activitypub' ), \esc_html( $actor['name'] ) ) . "\r\n";
/* translators: Actor URL */
$message .= \sprintf( \esc_html__( 'URL: %s', 'activitypub' ), \esc_url( $actor['url'] ) ) . "\r\n\r\n";

\wp_mail( $email, $subject, $message );
Copy link
Member Author

@pfefferle pfefferle Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we support HTML mails for direct messages?

Suggested change
$message = \sprintf( \esc_html__( 'New Direct Message: %2$s', 'activitypub' ), \esc_html( get_option( 'blogname' ) ), \wp_strip_all_tags( $activity['object']['content'] ) ) . "\r\n\r\n";
/* translators: Actor name */
$message .= \sprintf( \esc_html__( 'From: %s', 'activitypub' ), \esc_html( $actor['name'] ) ) . "\r\n";
/* translators: Actor URL */
$message .= \sprintf( \esc_html__( 'URL: %s', 'activitypub' ), \esc_url( $actor['url'] ) ) . "\r\n\r\n";
\wp_mail( $email, $subject, $message );
$message = \sprintf( \esc_html__( 'New Direct Message: %2$s', 'activitypub' ), \esc_html( get_option( 'blogname' ) ), \wp_kses( $activity['object']['content'] ) ) . "<br/><br/>";
/* translators: Actor name */
$message .= \sprintf( \esc_html__( 'From: %s', 'activitypub' ), \esc_html( $actor['name'] ) ) . "<br/>";
/* translators: Actor URL */
$message .= \sprintf( \esc_html__( 'URL: %s', 'activitypub' ), \esc_url( $actor['url'] ) ) . "<br/><br/>";
\wp_mail( $email, $subject, $message, array( 'Content-Type: text/html' ) );

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not working code, just to show how it might be possible!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine as is for now.

@pfefferle pfefferle merged commit 29053f3 into trunk Dec 11, 2024
24 checks passed
@pfefferle pfefferle deleted the fix/mailer branch December 11, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants