Display the correct domain in the message

[MAILPOET-1573]
This commit is contained in:
Pavel Dohnal
2019-01-22 14:34:10 +01:00
parent 4fb4e5a37a
commit 8cba3ba9d2
2 changed files with 7 additions and 6 deletions

View File

@@ -53,16 +53,17 @@ const badDomains = [
];
const SenderEmailAddressWarning = ({ emailAddress }) => {
const domain = emailAddress.split('@').pop().toLowerCase();
if (badDomains.indexOf(domain) > -1) {
const emailAddressDomain = emailAddress.split('@').pop().toLowerCase();
if (badDomains.indexOf(emailAddressDomain) > -1) {
const userHostDomain = window.location.hostname.replace('www.', '');
return (<React.Fragment>
<p className="sender_email_address_warning">{MailPoet.I18n.t('senderEmailAddressWarning1')}</p>
<p className="sender_email_address_warning">
{ReactStringReplace(
MailPoet.I18n.t('senderEmailAddressWarning2'),
/(%userDomain|%originalSender|<em>.*<\/em>)/,
/(%suggested|%originalSender|<em>.*<\/em>)/,
(match) => {
if (match === '%userDomain') return 'user domain'; // TODO replace with the real domain
if (match === '%suggested') return `info@${userHostDomain}`;
if (match === '%originalSender') return <em key="sender-email">{ emailAddress }</em>;
return <em key="reply-to">{match.replace(/<\/?em>/g, '')}</em>;
}

View File

@@ -67,8 +67,8 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
<%= localize({
'ajaxFailedErrorMessage': __('An error has happened while performing a request, the server has responded with response code %d'),
'senderEmailAddressWarning1': _x('You might not reach the inbox of your subscribers if you use this email address.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
'senderEmailAddressWarning2': _x('Use an address like s%userDomain for the Sender and put %originalSender in the the <em>Reply-to</em> field below.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
'senderEmailAddressWarning3': __('Read more.'),
'senderEmailAddressWarning2': _x('Use an address like %suggested for the Sender and put %originalSender in the the <em>Reply-to</em> field below.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
'senderEmailAddressWarning3': _x('Read more.'),
}) %>
<% block translations %><% endblock %>