# 某些 Mailgun 提供商的旧变量不受支持

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/mailgun-provider-variables

🌐 Some Mailgun provider legacy variables are not supported

在 Strapi 5 中，遗留的 Mailgun 提供者变量 `apiKey` 和 `host` 不再受支持；请改用 `key` 和 `url`。

🌐 In Strapi 5, legacy Mailgun provider variables `apiKey` and `host` are no longer supported; use `key` and `url` instead.

在 Strapi 5 中，不再支持 Mailgun 提供商在 Strapi v4 中弃用的一些旧变量。

🌐 In Strapi 5, the support is dropped for some legacy variables deprecated in Strapi v4 for the Mailgun provider.

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? Yes
- Is this breaking change automatically handled by a codemod? No

## 重大变更描述 {#breaking-change-description}

🌐 Breaking change description

**在 Strapi v4 中**

Mailgun 提供商选项可以使用传统的 `apiKey` 和 `host` 变量。

🌐 Mailgun provider options can use the legacy `apiKey` and `host` variables.

**在 Strapi 5 中**

Mailgun 提供商选项不能使用旧的 `apiKey` 和 `host` 变量，必须改用 `key` 和 `url` 变量。

🌐 Mailgun provider options can not use the legacy `apiKey` and `host` variables and must use the `key` and `url` variables instead.

## 迁移 {#migration}

🌐 Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

🌐 This section regroups useful notes and procedures about the introduced breaking change.

### 注意 {#notes}

🌐 Notes

在 Strapi 5 中，Mailgun [提供者](/cms/features/email#providers) 在 [插件配置文件](/cms/configurations/plugins) 中的配置可以如下示例所示：

🌐 A Mailgun [provider](/cms/features/email#providers) configuration in the [plugins configuration file](/cms/configurations/plugins) could look like the following example in Strapi 5:

```jsx title="/config/plugins.js"
module.exports = ({ env }) => ({
  // ...
  email: {
    config: {
      provider: 'mailgun',
      providerOptions: {
        key: env('MAILGUN_API_KEY'), // Required
        domain: env('MAILGUN_DOMAIN'), // Required
        url: env('MAILGUN_URL', 'https://api.mailgun.net'), //Optional. If domain region is Europe use 'https://api.eu.mailgun.net'
      },
      settings: {
        defaultFrom: 'myemail@protonmail.com',
        defaultReplyTo: 'myemail@protonmail.com',
      },
    },
  },
  // ...
});
```

### 手动操作 {#manual-procedure}

🌐 Manual procedure

如果你使用的是旧参数：

🌐 If you were using the legacy parameters:

1. 将 `apiKey` 重命名为 `key`。
2. 将 `host` 重命名为 `url`，并在其前面添加 `https://`，以使其成为一个正确的 URL。
