Home / Admin / Remove “mail.readwrite” Scope for the Outlook Mailer
Duplicate Snippet

Embed Snippet on Your Site

Remove “mail.readwrite” Scope for the Outlook Mailer

This snippet removes the `mail.readwrite` scope from the WP Mail SMTP plugin Outlook provider.

Code Preview
php
<?php
/* Removing "mail.readwrite" for the Outlook Mailer  
 * 
 * Original doc: https://wpmailsmtp.com/docs/removing-mail-readwrite-scope-for-the-outlook-mailer/
*/
add_filter( 'wp_mail_smtp_pro_providers_outlook_auth_get_scopes', function ( $scopes ) {
	foreach ( $scopes as $key => $scope ) {
		if ( $scope === 'https://graph.microsoft.com/mail.readwrite' ) {
			unset( $scopes[ $key ] );
		}
	}
	return $scopes;
} );
// Prevent the WP Mail SMTP plugin from using endpoints for large attachments via Outlook provider.
add_filter( 'wp_mail_smtp_pro_providers_outlook_mailer_send_large', '__return_false' );

Comments

Add a Comment