Filter Hooks – Post SMTP

Start Using Post SMTP for Free

Email

The form has been submitted successfully!

Filter Hooks

Estimated reading: 2 minutes 1568 views

This documentation is intended for developers and contains PHP code examples. If you’re not familiar with PHP or WordPress development, we recommend avoiding custom code changes to prevent performance issues with your site.

The following code snippets are native to the Post SMTP plugin.

All of the following code snippets can be added to your theme’s functions.php file or a custom plugin if you prefer keeping modifications separate from theme updates.

Note: Ensure the Post SMTP plugin is installed and activated on your WordPress site before proceeding.

ps_aedl_pre_wp_mail

The code snippet will filter the email log object before the email is sent using wp_mail().

add_filter( 'ps_aedl_pre_wp_mail', function( $log ) { 
	$log->original_subject = '[Modified] ' . $log->original_subject; 
	return $log;
})

postman_rat_reporting_email_to

The code snippet will filter the email address to which the report is sent. This allows customization of the recipient address for reports, overriding the default admin_email.

add_filter( 'postman_rat_reporting_email_to', function( $email ) {    return '[email protected]'; });

postman_rat_reporting_email_site_title

he code snippet will filter the site title to be used in the email subject. Customize the title shown in email reports by modifying the default get_bloginfo(‘name’).

add_filter( 'postman_rat_reporting_email_site_title', function( $title ) { return 'My Custom Site Title'; });

post_smtp_from_name

The code snippet will filter the “From name” used in outgoing emails.

add_filter( 'post_smtp_from_name', function( $name ) { return 'My Site Name'; });

post_smtp_from_email_address

The code snippet will filter the “Email address” used in outgoing emails.

add_filter( post_smtp_from_email_address, function( $email  ) {
    return '[email protected];
});

post_smtp_reply_to

The code snippet will filter the “Reply to” address used in outgoing emails.

add_filter( 'post_smtp_reply_to', function( $replyTo ) {
    return '[email protected]';
});

post_smtp_do_send_email

This snippet filters whether the email should be sent or not.

$send_email = apply_filters( 'post_smtp_do_send_email', true );

Looking to customize more aspects of Post SMTP? Browse our Action Hooks and Microsoft Office 365 guides for further enhancements.

Share this Doc

Filter Hooks

Or copy link

CONTENTS
👋 Having issues sending email
in WordPress? Lets Chat 👇
Scroll to Top