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

[Feature Request] Please support pre_wp_mail filter. #69

Open
kriptor opened this issue Nov 26, 2022 · 5 comments · May be fixed by #72
Open

[Feature Request] Please support pre_wp_mail filter. #69

kriptor opened this issue Nov 26, 2022 · 5 comments · May be fixed by #72

Comments

@kriptor
Copy link

kriptor commented Nov 26, 2022

I would like to interact with mail sending process using pre_wp_mail, but your wp_mail is not applying the filter. Would you be so kind and do something similar to vanilla wp_mail. Thx!

                /**
		 * Filters whether to preempt sending an email.
		 *
		 * Returning a non-null value will short-circuit {@see wp_mail()}, returning
		 * that value instead. A boolean return value should be used to indicate whether
		 * the email was successfully sent.
		 *
		 * @since 5.7.0
		 *
		 * @param null|bool $return Short-circuit return value.
		 * @param array     $atts {
		 *     Array of the `wp_mail()` arguments.
		 *
		 *     @type string|string[] $to          Array or comma-separated list of email addresses to send message.
		 *     @type string          $subject     Email subject.
		 *     @type string          $message     Message contents.
		 *     @type string|string[] $headers     Additional headers.
		 *     @type string|string[] $attachments Paths to files to attach.
		 * }
		 */
		$pre_wp_mail = apply_filters( 'pre_wp_mail', null, $atts );

		if ( null !== $pre_wp_mail ) {
			return $pre_wp_mail;
		}
@smusmanobjects
Copy link
Collaborator

Hi,

I hope you're doing well.
Thanks for using the plugin and suggesting, hopefully we'll add this in upcoming release.

Thanks

@TheCrowned
Copy link

Agreed, I was also looking for this! Would make Post SMTP a swappable wp_mail version.

@TheCrowned
Copy link

@smusmanobjects I'm happy to submit a PR, if you accept them.

@wpexpertsio
Copy link
Owner

@TheCrowned , Sure you can submit a PR for this.

@TheCrowned
Copy link

@wpexpertsio lovely! PR sent - it's quite simple. Hope to see this live soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants