DS SMTP Plugin
Send transactional emails via Postmark API or manual SMTP configuration
by DigiSavvy · github.com/digisavvy-inc/ds-smtp-plugin · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/digisavvy-inc/ds-smtp-plugin/archive/refs/heads/main.zipA robust WordPress plugin for sending transactional emails via Postmark API or manual SMTP configuration.
Description
DS SMTP Plugin allows you to reliably send WordPress emails through professional email services. It supports both Postmark's API and manual SMTP configuration, making it flexible for various hosting environments and email providers.
Features
-
Multiple Email Providers
- Postmark HTTP API integration (recommended)
- Postmark SMTP fallback option
- Manual SMTP configuration for any provider
- Easy switching between providers
-
Reliable Error Detection
- Immediate error detection with Postmark HTTP API
- Accurate email logging (no false positives)
- Clear, detailed error messages from API responses
- Enhanced SMTP error detection for other providers
-
User-Friendly Interface
- Clean, intuitive settings page
- Test email functionality
- Quick setup guides
- Choose between plain text or HTML email format
-
Email Logging
- Optional email logging for debugging
- View sent and failed emails
- Detailed error messages
- Log management interface
-
Security
- Secure password storage
- WordPress nonce verification
- Capability checks
- Sanitized inputs
-
Developer Friendly
- Clean, well-documented code
- WordPress coding standards
- Extensible architecture
- Action and filter hooks
- WP-CLI command support
Installation
Manual Installation
- Download the plugin files
- Upload the
ds-smtp-pluginfolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Settings > DS SMTP to configure
Configuration
- Navigate to Settings > DS SMTP in your WordPress admin
- Choose your email provider (Postmark API or Manual SMTP)
- Configure your provider settings:
Postmark API Setup (Recommended)
The plugin uses Postmark's HTTP API by default, which provides:
- Immediate error detection - Know instantly if an email fails
- Accurate logging - No false positives for failed emails
- Better error messages - Clear explanations from Postmark API
- More reliable - No SMTP timing or parsing issues
Setup steps:
- Sign up at postmarkapp.com
- Create a Server and get your Server API Token
- Important: Verify your sender signature or domain in Postmark
- Enter the API Token in the plugin settings
- Set your From Email and From Name
- Ensure "Use Postmark API" is checked (recommended)
- Save settings and send a test email
Note: The "From Email" must be a verified sender signature in your Postmark account. Unverified senders will be rejected immediately (not marked as success).
Manual SMTP Setup
- Get SMTP credentials from your email provider
- Enter the following information:
- SMTP Host: e.g.,
smtp.postmarkapp.com,smtp.gmail.com - SMTP Port: Common ports are 587 (TLS), 465 (SSL), 25, or 2525
- Encryption: Choose TLS, SSL, or None
- Username: Your SMTP username
- Password: Your SMTP password
- SMTP Host: e.g.,
- Set your From Email and From Name
- Save settings and send a test email
Email Format
Choose between plain text or HTML email format:
- In the General Settings section, find the Email Format dropdown
- Select either:
- Plain Text (default) - Sends emails as plain text
- HTML - Sends emails as HTML for rich formatting
- Individual emails can override this setting using Content-Type headers
Note: Plain text is the default and recommended format for most transactional emails. Use HTML format only if you need rich formatting (images, links, styling).
Common SMTP Settings
Postmark SMTP
- Host:
smtp.postmarkapp.com - Port:
587(TLS) or2525 - Username: Your API Token
- Password: Your API Token
Gmail
- Host:
smtp.gmail.com - Port:
587(TLS) or465(SSL) - Username: Your Gmail address
- Password: App-specific password (recommended)
SendGrid
- Host:
smtp.sendgrid.net - Port:
587(TLS) or465(SSL) - Username:
apikey - Password: Your SendGrid API Key
Mailgun
- Host:
smtp.mailgun.org - Port:
587(TLS) or465(SSL) - Username: Your Mailgun SMTP username
- Password: Your Mailgun SMTP password
Email Logging
Enable email logging for debugging purposes:
- Check Enable Email Logging in the plugin settings
- View logs at Settings > Email Logs
- See detailed information about sent and failed emails
- Clear logs when no longer needed
Note: Logging is intended for debugging and should be disabled in production to save database space.
Test Email
After configuring your settings:
- Enter an email address in the "Send Test Email" section
- Click "Send Test Email"
- Check your inbox for the test email
- If successful, your configuration is working correctly
WP-CLI Support
The plugin includes WP-CLI commands for sending emails from the command line. This is useful for testing, automation, and debugging purposes.
Basic Usage
Send a simple text email:
wp ds-smtp send \
--to="recipient@example.com" \
--subject="Test Email" \
--message="Hello from WP-CLI!"
Send HTML Email
Use the --html flag to send HTML formatted emails:
wp ds-smtp send \
--to="recipient@example.com" \
--subject="HTML Email" \
--message="<h1>Hello!</h1><p>This is an HTML email.</p>" \
--html
Override Sender Information
By default, the command uses the sender email configured in the plugin settings. You can override it:
wp ds-smtp send \
--to="recipient@example.com" \
--subject="Custom Sender" \
--message="Test message" \
--from="custom@example.com" \
--from-name="Custom Name"
Send to Multiple Recipients
Separate multiple recipients with commas:
wp ds-smtp send \
--to="user1@example.com,user2@example.com,user3@example.com" \
--subject="Bulk Email" \
--message="Hello everyone!"
Available Parameters
--to(required): Recipient email address(es), comma-separated for multiple recipients--subject(required): Email subject line--message(required): Email message body (plain text or HTML)--from(optional): Override the configured sender email address--from-name(optional): Override the configured sender name--html(optional): Send as HTML email (default is plain text)
Get Help
For detailed help on the command:
wp help ds-smtp send
Troubleshooting
Emails Not Sending
- Verify your SMTP credentials are correct
- Check if your host/port combination is correct
- Ensure your hosting provider allows outbound SMTP connections
- Try different ports (587, 465, 2525, 25)
- Enable email logging to see error messages
Common Issues
Connection Timeout
- Your hosting provider may be blocking SMTP connections
- Try alternative ports (2525 is often less restricted)
- Contact your hosting provider
Authentication Failed
- Double-check your username and password
- Some providers require app-specific passwords (Gmail, Yahoo)
- Verify your API token is correct (Postmark)
SSL/TLS Errors
- Try switching between SSL and TLS encryption
- Ensure your server has up-to-date SSL certificates
- Some servers require no encryption on certain ports
Requirements
- WordPress 5.8 or higher
- PHP 7.4 or higher
- MySQL 5.6 or higher
Support
For issues, questions, or contributions:
- Plugin URI: https://digisavvy.com
- Author: DigiSavvy
- License: GPL v2 or later
Changelog
1.0.0
- Initial release
- Postmark API integration
- Manual SMTP configuration
- Email logging functionality
- Test email feature
- Admin settings interface
Developer Notes
Hooks and Filters
The plugin provides hooks for developers:
// Modify email before sending
add_filter('ds_smtp_mail_data', function($mail_data) {
// Modify $mail_data array
return $mail_data;
});
// Custom email logging
add_action('ds_smtp_email_sent', function($mail_data) {
// Custom logging logic
});
File Structure
ds-smtp-plugin/
├── assets/
│ ├── css/
│ │ └── admin.css
│ └── js/
│ └── admin.js
├── includes/
│ ├── class-email-logger.php
│ └── class-wpcli-command.php
├── templates/
│ ├── admin-settings.php
│ └── email-logs.php
├── ds-smtp-plugin.php
└── README.md
Privacy
This plugin:
- Does not collect or transmit any user data
- Stores email logs locally (when enabled)
- Stores SMTP credentials in the WordPress database
- Does not use external services except for sending emails
License
This plugin is licensed under GPL v2 or later.
DS SMTP Plugin
Copyright (C) 2024 DigiSavvy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.