Skip to content

Commit 55d7703

Browse files
committed
feat: add an admin notice when ses email is disabled because of the vanity domain
1 parent 73016db commit 55d7703

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

pluggable.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
add_action('admin_notices', function () {
2525
echo '<div class="notice notice-warning"><p><strong>Ymir:</strong> Sending emails using SES is disabled because the "wp_mail" function was already overridden by another plugin.</p></div>';
2626
});
27-
} elseif ($ymir->isSesEnabled() && !function_exists('wp_mail')) {
27+
} elseif ($ymir->isSesEnabled() && $ymir->isUsingVanityDomain()) {
28+
add_action('admin_notices', function () {
29+
echo '<div class="notice notice-warning"><p><strong>Ymir:</strong> Sending emails using SES is disabled because the site is using a vanity domain. To learn how to map a domain to your environment, check out <a href="https://docs.ymirapp.com/guides/domain-mapping.html">this guide</a>.</p></div>';
30+
});
31+
} elseif ($ymir->isSesEnabled() && !$ymir->isUsingVanityDomain() && !function_exists('wp_mail')) {
2832
/**
2933
* Send email using the cloud provider email client.
3034
*/

src/Plugin.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,18 @@ public function isLoaded(): bool
112112
*/
113113
public function isSesEnabled(): bool
114114
{
115-
return !$this->container['ymir_using_vanity_domain']
116-
&& false === getenv('YMIR_DISABLE_SES')
115+
return false === getenv('YMIR_DISABLE_SES')
117116
&& (!defined('YMIR_DISABLE_SES') || !YMIR_DISABLE_SES);
118117
}
119118

119+
/**
120+
* Checks if the site is using a vanity domain.
121+
*/
122+
public function isUsingVanityDomain(): bool
123+
{
124+
return $this->container['ymir_using_vanity_domain'];
125+
}
126+
120127
/**
121128
* Loads the plugin into WordPress.
122129
*/

0 commit comments

Comments
 (0)