How to Grant User Role Access to the Post SMTP Email Log
Content
One of the most common questions from users of the Post SMTP plugin is how to allow non-administrator user roles, such as Editors or Shop Managers, to view the email log. By default, the plugin restricts log access to users with the Administrator role. This guide explains why this is the default behavior and provides the most common methods for granting access to other user roles.
Why is Access Restricted by Default?
The Post SMTP plugin handles critical site functionality—email delivery. Granting access to its settings and logs also grants the ability to view potentially sensitive information and, in some cases, alter the site's email configuration. Therefore, access is limited to Administrators by default to maintain security and stability.
Method 1: Using a User Role Editor Plugin (Recommended)
The most straightforward and commonly recommended solution is to use a dedicated user role management plugin. This approach is safer than modifying code and gives you fine-grained control over permissions.
Recommended Plugins:
- Advanced Access Manager (AAM): A powerful plugin frequently suggested by the community for this specific task.
- User Role Editor: Another popular option that allows you to manage capabilities for any role.
Steps:
- Install and activate your chosen user role editor plugin.
- Navigate to the plugin's settings page (often found under Users in the WordPress admin menu).
- Select the role you want to modify (e.g., 'Editor', 'Shop Manager').
- Look for and enable the following capabilities:
manage_postman_smtpmanage_postman_logs
- Save the changes.
Important Note: As indicated in the support threads, granting the manage_postman_smtp capability will typically give users of that role full access to the Post SMTP settings, not just read-only access to the logs. Always test permissions after making changes.
Method 2: Custom Code Snippet (For Developers)
For developers comfortable with code, you can add a custom function to your theme's functions.php file or a custom site-specific plugin. This example adds the necessary capabilities to the 'shop_manager' role.
function my_custom_add_post_smtp_caps() {
// Get the Shop Manager role object
$shop_manager_role = get_role( 'shop_manager' );
// Add the capabilities to view and manage logs and settings
if ( $shop_manager_role && ! $shop_manager_role->has_cap( 'manage_postman_logs' ) ) {
$shop_manager_role->add_cap( 'manage_postman_smtp' );
$shop_manager_role->add_cap( 'manage_postman_logs' );
}
}
add_action( 'init', 'my_custom_add_post_smtp_caps' );
Warning: Editing theme files directly is not best practice, as updates can erase your changes. Use a child theme or a code snippet plugin for a more sustainable solution. This method also provides full management access.
What About Read-Only Log Access?
A frequent feature request is the ability to grant read-only access to the email log without granting full management capabilities. Based on the analyzed support threads, this functionality is not natively available in the free version of the Post SMTP plugin. The provided solutions grant full management access.
Alternative: The Post SMTP Mobile App
An alternative for providing log access, specifically for failed emails, is the official Post SMTP Mobile App. Users can connect their account to the mobile app to check email logs. This can be a good solution for providing access without altering WordPress user roles.
Conclusion
While the Post SMTP plugin does not include a built-in setting for granular role management, access for Editors, Shop Managers, and other roles can be successfully granted using a third-party role editor plugin or custom code. The plugin team has acknowledged this as a common request in their support forums. Always remember that with greater access comes greater responsibility, so only grant these permissions to trusted users.
Related Support Threads Support
-
Give permissions to view email loghttps://wordpress.org/support/topic/give-permissions-to-view-email-log-2/
-
1) Embed Postman Logs; 2) Query/Filter SMTP Logshttps://wordpress.org/support/topic/1-embed-postman-logs-2-query-filter-smtp-logs/
-
Exclude selected mails from logging using wp_mail()?https://wordpress.org/support/topic/exclude-selected-mails-from-logging-using-wp_mail/
-
editor access to mail loghttps://wordpress.org/support/topic/editor-access-to-mail-log/
-
Log Only Mode for staging / devhttps://wordpress.org/support/topic/log-only-mode-for-staging-dev/
-
Shop Manager Role Access to Email Loghttps://wordpress.org/support/topic/shop-manager-role-access-to-email-log/
-
Allow Editor Access to Post SMTP Email Loghttps://wordpress.org/support/topic/allow-editor-access-to-post-smtp-email-log/
-
Email log acessible for certain user roleshttps://wordpress.org/support/topic/email-log-acessible-for-certain-user-roles/
-
Store Manager access the plugin settings.https://wordpress.org/support/topic/store-manager-access-the-plugin-settings/
-
Get mail log entries via WP JSON API?https://wordpress.org/support/topic/get-mail-log-entries-via-wp-json-api/
-
Email Logs Not Workinghttps://wordpress.org/support/topic/email-logs-not-working/
-
Log opened or clicked mailhttps://wordpress.org/support/topic/log-opened-or-clicked-mail/
-
email loghttps://wordpress.org/support/topic/email-log-5/