wpexpertsio/Post-SMTP

[Feature Request] Please support pre_wp_mail filter.

kriptor opened this issue · 5 comments

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;
		}

Hi,

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

Thanks

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

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

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

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