This WordPress plugin redirects users to URLs based on their email domain. Users enter their email address in a form, and the plugin automatically opens the appropriate URL based on domain mappings you configure.
- Widget-based email input form
- Shortcode support for inline placement in posts and pages
- Admin settings page for easy domain-to-URL configuration
- Subdomain matching with priority over main domain matches
- Popup window with fallback link if popups are blocked
- AJAX-based submission for smooth user experience
- Input validation for email addresses
-
Create a folder named
email-redirectin your WordPresswp-content/plugins/directory -
Copy all plugin files into this folder:
- email-redirect.php (main plugin file)
- widget.php
- script.js
- style.css
- admin-script.js
- admin-style.css
- languages/ (folder with translation files)
-
Activate the plugin through the WordPress admin panel (Plugins > Installed Plugins)
If you modify the .po translation files, regenerate the compiled .mo files:
cd wp-content/plugins/email-redirect/languages
msgfmt -o email-redirect-nl_NL.mo email-redirect-nl_NL.po- Go to Settings > Email Redirect in your WordPress admin
- Add domain-to-URL mappings:
- Enter the domain (without protocol), e.g.,
company.comormail.company.com - Enter the complete redirect URL, e.g.,
https://example.com/page
- Enter the domain (without protocol), e.g.,
- Click "Add Mapping" to add more rows
- Click "Remove" to delete unwanted mappings
- Click "Save Changes" when done
The plugin uses the following matching logic:
- First attempts exact domain match (including subdomain if present)
- If no exact match, extracts and checks the main domain + TLD
- Subdomain configurations always take precedence
Example:
- If you configure both
mail.company.comandcompany.com - Email
user@mail.company.comwill matchmail.company.comfirst - Email
user@company.comwill matchcompany.com - Email
user@support.company.comwill matchcompany.com(main domain fallback)
- Go to Appearance > Widgets in WordPress admin
- Find "Email Redirect Form" widget
- Drag it to your desired widget area (sidebar, footer, etc.)
- Optionally set a custom title
- Save the widget
You can also embed the form directly in any post, page, or shortcode-enabled area:
[email_redirect_form]
With a custom title:
[email_redirect_form title="Enter Your Email"]
When a user submits their email:
- The plugin validates the email format
- Extracts the domain from the email
- Finds the matching redirect URL from your configuration
- Opens the URL in a new browser window
- Shows a confirmation message with a clickable link
- If the domain is not found, shows an error message
email-redirect/
├── email-redirect.php # Main plugin file
├── widget.php # Widget class
├── script.js # Frontend JavaScript
├── style.css # Widget styling
├── admin-script.js # Admin JavaScript
├── admin-style.css # Admin styling
└── languages/ # Translation files
├── email-redirect.pot # Translation template
├── email-redirect-nl_NL.po # Dutch translation source
└── email-redirect-nl_NL.mo # Dutch translation (compiled)
The plugin includes Dutch (nl_NL) translations and is fully translatable.
To compile translations, you need gettext which provides the msgfmt command:
Ubuntu/Debian:
sudo apt install gettextmacOS (Homebrew):
brew install gettextWindows: Download from GNU gettext or use Poedit.
-
Copy the template file to create a new translation:
cp email-redirect.pot email-redirect-de_DE.po
-
Edit the
.pofile with a text editor or Poedit, translating eachmsgstrentry -
Compile the
.pofile to.mo:msgfmt -o email-redirect-de_DE.mo email-redirect-de_DE.po
-
Edit the
.pofile (e.g.,email-redirect-nl_NL.po) -
Recompile to
.mo:msgfmt -o email-redirect-nl_NL.mo email-redirect-nl_NL.po
Poedit provides a graphical interface for editing translations and automatically generates the .mo file when you save.
- Uses WordPress AJAX for form processing
- Nonce verification for security
- Sanitization and validation of all inputs
- Responsive form design
- Compatible with standard WordPress themes
- WordPress 5.0 or higher
- PHP 7.0 or higher
- jQuery (included with WordPress)
For issues or questions, contact your plugin administrator.
This plugin is licensed under the GPL-2.0-or-later license.