WP Manifestindependent plugin directory
manifest / email / ds-smtp-plugin

DS SMTP Plugin

Send transactional emails via Postmark API or manual SMTP configuration

by DigiSavvy · github.com/digisavvy-inc/ds-smtp-plugin · website

0stars
0forks

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.zip

A 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

  1. Download the plugin files
  2. Upload the ds-smtp-plugin folder to /wp-content/plugins/
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Go to Settings > DS SMTP to configure

Configuration

  1. Navigate to Settings > DS SMTP in your WordPress admin
  2. Choose your email provider (Postmark API or Manual SMTP)
  3. 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:

  1. Sign up at postmarkapp.com
  2. Create a Server and get your Server API Token
  3. Important: Verify your sender signature or domain in Postmark
  4. Enter the API Token in the plugin settings
  5. Set your From Email and From Name
  6. Ensure "Use Postmark API" is checked (recommended)
  7. 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

  1. Get SMTP credentials from your email provider
  2. 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
  3. Set your From Email and From Name
  4. Save settings and send a test email

Email Format

Choose between plain text or HTML email format:

  1. In the General Settings section, find the Email Format dropdown
  2. Select either:
    • Plain Text (default) - Sends emails as plain text
    • HTML - Sends emails as HTML for rich formatting
  3. 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) or 2525
  • Username: Your API Token
  • Password: Your API Token

Gmail

  • Host: smtp.gmail.com
  • Port: 587 (TLS) or 465 (SSL)
  • Username: Your Gmail address
  • Password: App-specific password (recommended)

SendGrid

  • Host: smtp.sendgrid.net
  • Port: 587 (TLS) or 465 (SSL)
  • Username: apikey
  • Password: Your SendGrid API Key

Mailgun

  • Host: smtp.mailgun.org
  • Port: 587 (TLS) or 465 (SSL)
  • Username: Your Mailgun SMTP username
  • Password: Your Mailgun SMTP password

Email Logging

Enable email logging for debugging purposes:

  1. Check Enable Email Logging in the plugin settings
  2. View logs at Settings > Email Logs
  3. See detailed information about sent and failed emails
  4. 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:

  1. Enter an email address in the "Send Test Email" section
  2. Click "Send Test Email"
  3. Check your inbox for the test email
  4. 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

  1. Verify your SMTP credentials are correct
  2. Check if your host/port combination is correct
  3. Ensure your hosting provider allows outbound SMTP connections
  4. Try different ports (587, 465, 2525, 25)
  5. 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:

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.