diff --git a/assets/js/src/newsletters/listings/mixins.jsx b/assets/js/src/newsletters/listings/mixins.jsx index 64a5325043..0fddf20511 100644 --- a/assets/js/src/newsletters/listings/mixins.jsx +++ b/assets/js/src/newsletters/listings/mixins.jsx @@ -421,44 +421,80 @@ const MailerMixin = { } }, getMailerError(state) { - let mailerErrorNotice; if (state.meta.mta_log.error.operation === 'migration') { - mailerErrorNotice = state.meta.mta_log.error.error_message; return (
-

{ mailerErrorNotice }

+

{ state.meta.mta_log.error.error_message }

); } - const mailerCheckSettingsNotice = ReactStringReplace( - MailPoet.I18n.t('mailerCheckSettingsNotice'), - /\[link\](.*?)\[\/link\]/g, - match => ( - { match } - ) - ); - if (state.meta.mta_log.error.operation === 'send') { - mailerErrorNotice = MailPoet.I18n.t('mailerSendErrorNotice') - .replace('%$1s', state.meta.mta_method) - .replace('%$2s', state.meta.mta_log.error.error_message); + + // offer MSS when PHPMail is failing + let mailerErrorCheckSettings; + if (state.meta.mta_method === 'PHPMail') { + mailerErrorCheckSettings = ( + <> +

{ MailPoet.I18n.t('mailerSendErrorCheckConfiguration') }

+
+

+ { + ReactStringReplace( + MailPoet.I18n.t('mailerSendErrorUseSendingService'), + /(.*?)<\/b>/g, + match => { match } + ) + } +

+

+ + { MailPoet.I18n.t('mailerSendErrorSignUpForSendingService') } + +

+
+ + ); } else { - mailerErrorNotice = MailPoet.I18n.t('mailerConnectionErrorNotice') - .replace('%$1s', state.meta.mta_log.error.error_message); + mailerErrorCheckSettings = ( +

+ { + ReactStringReplace( + MailPoet.I18n.t('mailerCheckSettingsNotice'), + /\[link\](.*?)\[\/link\]/g, + match => { match } + ) + } +

+ ); } + + // append error code if available + let mailerErrorMessage = state.meta.mta_log.error.error_message; if (state.meta.mta_log.error.error_code) { - mailerErrorNotice += ` ${MailPoet.I18n.t('mailerErrorCode') - .replace('%$1s', state.meta.mta_log.error.error_code)}`; + mailerErrorMessage += mailerErrorMessage ? ', ' : ''; + mailerErrorMessage += MailPoet.I18n.t('mailerErrorCode').replace('%$1s', state.meta.mta_log.error.error_code); } - // eslint-disable-next-line react/no-danger - mailerErrorNotice =

; + return (

- { mailerErrorNotice } -

{ mailerCheckSettingsNotice }

+

+ { + state.meta.mta_log.error.operation === 'send' + ? MailPoet.I18n.t('mailerSendErrorNotice').replace('%$1s', state.meta.mta_method) + : MailPoet.I18n.t('mailerConnectionErrorNotice') + } + : + {' '} + { mailerErrorMessage } +

+ { mailerErrorCheckSettings }

{ MailPoet.I18n.t('mailerResumeSendingButton') } diff --git a/views/newsletters.html b/views/newsletters.html index ce851d94a9..5b3dd46155 100644 --- a/views/newsletters.html +++ b/views/newsletters.html @@ -278,8 +278,11 @@ 'backToPostNotifications': __('Back to Post notifications'), 'noSubscribers': __('No subscribers!'), - 'mailerSendErrorNotice': __('Sending is paused because %$1s prevents MailPoet from delivering emails with the following error: %$2s'), - 'mailerConnectionErrorNotice': __('Sending is paused because the following connection issue prevents MailPoet from delivering emails: %$1s'), + 'mailerSendErrorNotice': __('Sending has been paused due to a technical issue with %$1s'), + 'mailerSendErrorCheckConfiguration': __('Please check your sending method configuration, you may need to consult with your hosting company.'), + 'mailerSendErrorUseSendingService': __('The easy alternative is to send emails with MailPoet Sending Service instead, like thousand of other users do.'), + 'mailerSendErrorSignUpForSendingService': __('Sign up for free in minutes'), + 'mailerConnectionErrorNotice': __('Sending is paused because the following connection issue prevents MailPoet from delivering emails'), 'mailerErrorCode': __('Error code: %$1s'), 'mailerCheckSettingsNotice': __('Check your [link]sending method settings[/link].'), 'mailerResumeSendingButton': __('Resume sending'),