diff --git a/js/src/admin/components/MailPage.js b/js/src/admin/components/MailPage.js
index 442e513d5..6a7b41e62 100644
--- a/js/src/admin/components/MailPage.js
+++ b/js/src/admin/components/MailPage.js
@@ -29,12 +29,13 @@ export default class MailPage extends Page {
{}
);
- Object.keys(this.driverFields).flatMap(key => this.driverFields[key]).forEach(
- key => {
- this.fields.push(key);
- this.values[key] = m.prop(settings[key]);
+ for (const driver in this.driverFields) {
+ for (const field in this.driverFields[driver]) {
+ this.fields.push(field);
+ this.values[field] = m.prop(settings[field]);
}
- );
+ }
+
this.loading = false;
m.redraw();
});
@@ -87,9 +88,9 @@ export default class MailPage extends Page {
className: 'MailPage-MailSettings',
children: [
- {this.driverFields[this.values.mail_driver()].flatMap(field => [
+ {Object.keys(this.driverFields[this.values.mail_driver()]).map(field => [
,
-
+ this.renderField(field),
])}
]
@@ -108,6 +109,18 @@ export default class MailPage extends Page {
);
}
+ renderField(name) {
+ const driver = this.values.mail_driver();
+ const field = this.driverFields[driver][name];
+ const prop = this.values[name];
+
+ if (typeof field === 'string') {
+ return ;
+ } else {
+ return ;
+ }
+ }
+
changed() {
return this.fields.some(key => this.values[key]() !== app.data.settings[key]);
}
diff --git a/src/Mail/MailgunDriver.php b/src/Mail/MailgunDriver.php
index 1ccbb96fd..d600db6b4 100644
--- a/src/Mail/MailgunDriver.php
+++ b/src/Mail/MailgunDriver.php
@@ -19,8 +19,12 @@ class MailgunDriver implements DriverInterface
public function availableSettings(): array
{
return [
- 'mail_mailgun_secret', // the secret key
- 'mail_mailgun_domain', // the API base URL
+ 'mail_mailgun_secret' => '', // the secret key
+ 'mail_mailgun_domain' => '', // the API base URL
+ 'mail_mailgun_region' => [ // region's endpoint
+ 'api.mailgun.net' => 'US',
+ 'api.eu.mailgun.net' => 'EU',
+ ],
];
}
@@ -29,7 +33,8 @@ class MailgunDriver implements DriverInterface
return new MailgunTransport(
new Client(['connect_timeout' => 60]),
$settings->get('mail_mailgun_secret'),
- $settings->get('mail_mailgun_domain')
+ $settings->get('mail_mailgun_domain'),
+ $settings->get('mail_mailgun_region')
);
}
}
diff --git a/src/Mail/MandrillDriver.php b/src/Mail/MandrillDriver.php
index 7cbaa7480..45a0c4051 100644
--- a/src/Mail/MandrillDriver.php
+++ b/src/Mail/MandrillDriver.php
@@ -19,7 +19,7 @@ class MandrillDriver implements DriverInterface
public function availableSettings(): array
{
return [
- 'mail_mandrill_secret',
+ 'mail_mandrill_secret' => '',
];
}
diff --git a/src/Mail/SesDriver.php b/src/Mail/SesDriver.php
index 774ad56a0..8248bab0e 100644
--- a/src/Mail/SesDriver.php
+++ b/src/Mail/SesDriver.php
@@ -19,9 +19,9 @@ class SesDriver implements DriverInterface
public function availableSettings(): array
{
return [
- 'mail_ses_key',
- 'mail_ses_secret',
- 'mail_ses_region',
+ 'mail_ses_key' => '',
+ 'mail_ses_secret' => '',
+ 'mail_ses_region' => '',
];
}
diff --git a/src/Mail/SmtpDriver.php b/src/Mail/SmtpDriver.php
index ae3ebdc39..b6233cfe8 100644
--- a/src/Mail/SmtpDriver.php
+++ b/src/Mail/SmtpDriver.php
@@ -18,11 +18,11 @@ class SmtpDriver implements DriverInterface
public function availableSettings(): array
{
return [
- 'mail_host', // a hostname, IPv4 address or IPv6 wrapped in []
- 'mail_port', // a number, defaults to 25
- 'mail_encryption', // "tls" or "ssl"
- 'mail_username', // required
- 'mail_password', // required
+ 'mail_host' => '', // a hostname, IPv4 address or IPv6 wrapped in []
+ 'mail_port' => '', // a number, defaults to 25
+ 'mail_encryption' => '', // "tls" or "ssl"
+ 'mail_username' => '', // required
+ 'mail_password' => '', // required
];
}