Title: Mailroad Switch
Author: MARSWorks Inc.
Published: <strong>2021 年 6 月 10 日</strong>
Last modified: 2021 年 6 月 10 日

---

搜索插件

![](https://ps.w.org/mailroad-switch/assets/banner-772x250.png?rev=2545859)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/mailroad-switch/assets/icon.svg?rev=2545859)

# Mailroad Switch

 作者：[MARSWorks Inc.](https://profiles.wordpress.org/marsworks/)

[下载](https://downloads.wordpress.org/plugin/mailroad-switch.1.0.zip)

 * [详情](https://cn.wordpress.org/plugins/mailroad-switch/#description)
 * [评价](https://cn.wordpress.org/plugins/mailroad-switch/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/mailroad-switch/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/mailroad-switch/#developers)

 [支持](https://wordpress.org/support/plugin/mailroad-switch/)

## 描述

This plugin allows you to set multiple admin email addresses. This means that you
can finally send all of those New User emails to go to HR, and send those WP Error
and Automatic Update emails to IT.

## 屏幕截图

[⌊New admin email options⌉⌊New admin email options⌉[

New admin email options

## 安装

 1. Upload `mailroad-switch.zip` through the ‘Add Plugins’ screen in WordPress.
 2. Activate the plugin in WordPress.
 3. Navigate to Settings > General to input your new email addresses.

## 常见问题

### What Plugins are Supported?

Currently, the only third-party plugin which is supported is ‘Enable jQuery Migrate
Helper’

We did this because this plugin is used on many sites since the release of WordPress
5.2. Enable jQuery Migrate Helper comes with weekly emails along with emails regarding
automatic downgrades of your site’s jQuery version.

You will be able to set an email recipient for the emails from Enable jQuery Migrate
Helper. This option will only show if you have the Enable jQuery Migrate Helper 
plugin in your WordPress plugins directory.

### How do I retrieve a value to use in my code?

You are able to use the static method `get_email_recipient`

    ```
    $address = \Mailroad_Switch\Includes\Settings::get_email_recipient( 'errors' );
    ```

Default valid values passed to the method are:
 + `updates` + `errors` + `users`
+ `jquery_migrate`

If the email type does not exist or the option is not set for it, it will fallback
to the admin email address you have set for your WordPress site.

### I have a plugin that is sending me emails, but I do not see an option to change the email recipient. What do I do?

You can open a question in the support forum to the right, and request that we add
support for a third-party plugin.

### I don’t have time to wait for you to add support for more plugins! I need to do it right now! *For Developers Only*

You are able to use the filter `mailroad_switch_available_hooks`

    ```
    add_filter( "mailroad_switch_available_hooks", function( $types ){
       if( ! array_key_exists( "my_unique_type", $types ) ){
          $types["my_unique_type"] = [
             "label" => "My Unique Type",
             "description" => "Emails coming from my custom plugin or theme",
             "class" => "\My\Class\Handler"
          ];
       }
       return $types;
    } );
    ```

The above code snippet will add a new admin setting below the other fields. The 
construct of your `\My\Class\Handler` should have one parameter which will be the
email address retrieved from the setting. You can then implement any WordPress or
Plugin or Theme action and filter hooks in your class to change email recipients.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Mailroad Switch」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ MARSWorks Inc. ](https://profiles.wordpress.org/marsworks/)

[帮助将「Mailroad Switch」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/mailroad-switch)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/mailroad-switch/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/mailroad-switch/)，或通过[RSS](https://plugins.trac.wordpress.org/log/mailroad-switch/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/mailroad-switch/)。

## 更新日志

#### 1.0

 * Initial launch of plugin
 * Includes support for WordPress Core email notifications for User notices, WP 
   Error notices, and Automatic Update notices.
 * Includes support for Enable jQuery Migrate Helper plugin email notices.

## 额外信息

 *  版本 **1.0**
 *  最后更新：**5 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 5.2 或更高版本 **
 *  已测试的最高版本为 **5.7.15**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [English (US)](https://wordpress.org/plugins/mailroad-switch/)
 * 标签
 * [admin](https://cn.wordpress.org/plugins/tags/admin/)[email](https://cn.wordpress.org/plugins/tags/email/)
   [emails](https://cn.wordpress.org/plugins/tags/emails/)[separate](https://cn.wordpress.org/plugins/tags/separate/)
 *  [高级视图](https://cn.wordpress.org/plugins/mailroad-switch/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/mailroad-switch/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/mailroad-switch/reviews/)

## 贡献者

 *   [ MARSWorks Inc. ](https://profiles.wordpress.org/marsworks/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/mailroad-switch/)