Skip to content
Docs
Get RestroPress

Action

rpress_email_send_before

Updated
On this page

Fires before an email is built and sent with RPRESS_Emails::send().

Runs in RPRESS_Emails::send() before tags are parsed, the body is built and wp_mail() is called. RestroPress uses it to attach the wp_mail_from, wp_mail_from_name and wp_mail_content_type filters. Use it to set up temporary filters for the duration of one email, and undo them in rpress_email_send_after.

Parameters#

ParameterTypeDescription
$emailsRPRESS_EmailsThe RPRESS_Emails instance sending the email.

Example#

function my_email_send_before( $emails ) {
	add_filter( 'wp_mail_charset', 'my_email_charset' );
}
function my_email_charset() {
	return 'UTF-8';
}
add_action( 'rpress_email_send_before', 'my_email_send_before' );

Notes#

Not fired when send() is called before init or admin_init has run; the method returns false in that case.

Source#

Fired from:

  • includes/emails/class-rpress-emails.php (line 299), in RPRESS_Emails::send()

See also#

Was this page helpful?