Add SPF record notice [MAILPOET-2295]
This commit is contained in:
27
assets/js/src/common/check_spf_record.jsx
Normal file
27
assets/js/src/common/check_spf_record.jsx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import MailPoet from 'mailpoet';
|
||||||
|
import _ from 'underscore';
|
||||||
|
|
||||||
|
const getErrorMessage = (domainName, senderAddress) => `<h3>${MailPoet.I18n.t('spfCheckTitle')}</h3>
|
||||||
|
<p>${MailPoet.I18n.t('spfCheckMsgWhy').replace('%s', _.escape(domainName))}</p>
|
||||||
|
<p>${MailPoet.I18n.t('spfCheckMsgEdit').replace('%s', '<em>include:spf.sendingservice.net</em>')}
|
||||||
|
<br>
|
||||||
|
<em>v=spf1 include:spf.protection.outlook.com include:sendgrid.net include:spf.sendingservice.net -all</em>
|
||||||
|
</p>
|
||||||
|
<p>${MailPoet.I18n.t('spfCheckMsgAllow').replace('%s', _.escape(senderAddress))}</p>
|
||||||
|
<p><a class="button button-primary" href="https://kb.mailpoet.com/article/151-email-authentication-spf-and-dkim" target="_blank">${MailPoet.I18n.t('spfCheckReadMore')}</a></p>`;
|
||||||
|
|
||||||
|
const checkSPFRecord = () => MailPoet.Ajax.post({
|
||||||
|
api_version: window.mailpoet_api_version,
|
||||||
|
endpoint: 'services',
|
||||||
|
action: 'checkSPFRecord',
|
||||||
|
data: {},
|
||||||
|
}).fail((response) => {
|
||||||
|
if (response.meta.domain_name && response.meta.sender_address) {
|
||||||
|
MailPoet.Notice.error(
|
||||||
|
getErrorMessage(response.meta.domain_name, response.meta.sender_address),
|
||||||
|
{ static: true, scroll: true, id: 'spf_check_error' }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default checkSPFRecord;
|
@@ -7,6 +7,7 @@ import Marionette from 'backbone.marionette';
|
|||||||
import SuperModel from 'backbone.supermodel';
|
import SuperModel from 'backbone.supermodel';
|
||||||
import _ from 'underscore';
|
import _ from 'underscore';
|
||||||
import jQuery from 'jquery';
|
import jQuery from 'jquery';
|
||||||
|
import checkSPFRecord from 'common/check_spf_record.jsx';
|
||||||
|
|
||||||
var Module = {};
|
var Module = {};
|
||||||
var SidebarView;
|
var SidebarView;
|
||||||
@@ -328,6 +329,9 @@ Module.SidebarPreviewView = Marionette.View.extend({
|
|||||||
'MailPoet Free version': window.mailpoet_version,
|
'MailPoet Free version': window.mailpoet_version,
|
||||||
'Domain name': data.subscriber.substring(data.subscriber.indexOf('@') + 1),
|
'Domain name': data.subscriber.substring(data.subscriber.indexOf('@') + 1),
|
||||||
});
|
});
|
||||||
|
if (App.getConfig().get('validation.validateSPFRecord')) {
|
||||||
|
checkSPFRecord();
|
||||||
|
}
|
||||||
showSuccessDeliveryPoll = MailPoet.Poll.successDelivery.canShow('preview');
|
showSuccessDeliveryPoll = MailPoet.Poll.successDelivery.canShow('preview');
|
||||||
if (showSuccessDeliveryPoll) {
|
if (showSuccessDeliveryPoll) {
|
||||||
MailPoet.Poll.successDelivery.showModal('preview', 'IHedf1');
|
MailPoet.Poll.successDelivery.showModal('preview', 'IHedf1');
|
||||||
|
@@ -75,6 +75,13 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
|
|||||||
'senderEmailAddressWarning2': _x('Use an address like %suggested for the Sender and put %originalSender in the <em>Reply-to</em> field below.', 'In the last step, before sending a newsletter. URL: ?page=mailpoet-newsletters#/send/2'),
|
'senderEmailAddressWarning2': _x('Use an address like %suggested for the Sender and put %originalSender in 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.'),
|
'senderEmailAddressWarning3': _x('Read more.'),
|
||||||
'mailerSendingResumedNotice': __('Sending has been resumed.'),
|
'mailerSendingResumedNotice': __('Sending has been resumed.'),
|
||||||
|
|
||||||
|
'spfCheckTitle': _x('Oops! You might not receive your own emails.', 'DNS SPF Record check'),
|
||||||
|
'spfCheckMsgWhy': _x("Why? You have an SPF entry for %s, but it's incomplete.", 'DNS SPF Record check'),
|
||||||
|
'spfCheckMsgEdit': _x('If you send with MailPoet, edit the SPF record in your DNS and add %s to it, so it looks like this:', 'DNS SPF Record check'),
|
||||||
|
'spfCheckMsgAllow': _x('This will allow MailPoet to send emails from %s addresses.', 'DNS SPF Record check'),
|
||||||
|
'spfCheckReadMore': _x('Read more about SPF', 'DNS SPF Record check'),
|
||||||
|
|
||||||
}) %>
|
}) %>
|
||||||
<% block translations %><% endblock %>
|
<% block translations %><% endblock %>
|
||||||
|
|
||||||
|
@@ -1395,6 +1395,7 @@
|
|||||||
},
|
},
|
||||||
validation: {
|
validation: {
|
||||||
validateUnsubscribeLinkPresent: <%= mss_active ? 'true' : 'false' %>,
|
validateUnsubscribeLinkPresent: <%= mss_active ? 'true' : 'false' %>,
|
||||||
|
validateSPFRecord: <%= mss_active ? 'true' : 'false' %>,
|
||||||
},
|
},
|
||||||
urls: {
|
urls: {
|
||||||
send: '<%= admin_url('admin.php?page=mailpoet-newsletters#/send/' ~ (params('id') | intval)) %>',
|
send: '<%= admin_url('admin.php?page=mailpoet-newsletters#/send/' ~ (params('id') | intval)) %>',
|
||||||
|
@@ -761,6 +761,9 @@
|
|||||||
$('.mailpoet_sending_service_activate').on('click', function(e, navigateToTab) {
|
$('.mailpoet_sending_service_activate').on('click', function(e, navigateToTab) {
|
||||||
$('#mta_group').val('mailpoet');
|
$('#mta_group').val('mailpoet');
|
||||||
saveSendingMethodConfiguration('mailpoet', navigateToTab);
|
saveSendingMethodConfiguration('mailpoet', navigateToTab);
|
||||||
|
if (MailPoetLib && MailPoetLib.checkSPFRecord) {
|
||||||
|
MailPoetLib.checkSPFRecord.default();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('.mailpoet_mta_setup_save').on('click', function() {
|
$('.mailpoet_mta_setup_save').on('click', function() {
|
||||||
$('#mailpoet_smtp_method').trigger("change");
|
$('#mailpoet_smtp_method').trigger("change");
|
||||||
|
@@ -110,6 +110,11 @@ const baseConfig = {
|
|||||||
include: path.resolve(__dirname, 'assets/js/src/hooks.js'),
|
include: path.resolve(__dirname, 'assets/js/src/hooks.js'),
|
||||||
use: 'expose-loader?' + globalPrefix + '.Hooks',
|
use: 'expose-loader?' + globalPrefix + '.Hooks',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Expose for usage in the settings view inline JS
|
||||||
|
include: path.resolve(__dirname, 'assets/js/src/common/check_spf_record.jsx'),
|
||||||
|
use: 'expose-loader?' + globalPrefix + '.checkSPFRecord',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
test: /listing.jsx/i,
|
test: /listing.jsx/i,
|
||||||
use: [
|
use: [
|
||||||
@@ -297,6 +302,7 @@ const adminConfig = {
|
|||||||
'newsletters/types/automatic_emails/events_list.jsx',
|
'newsletters/types/automatic_emails/events_list.jsx',
|
||||||
'newsletters/types/automatic_emails/breadcrumb.jsx',
|
'newsletters/types/automatic_emails/breadcrumb.jsx',
|
||||||
'newsletters/types/welcome/scheduling.jsx',
|
'newsletters/types/welcome/scheduling.jsx',
|
||||||
|
'common/check_spf_record.jsx',
|
||||||
],
|
],
|
||||||
admin: 'webpack_admin_index.jsx',
|
admin: 'webpack_admin_index.jsx',
|
||||||
form_editor: 'form_editor/webpack_index.jsx',
|
form_editor: 'form_editor/webpack_index.jsx',
|
||||||
|
Reference in New Issue
Block a user