test sending method works
This commit is contained in:
@@ -108,7 +108,7 @@ class Mailer {
|
|||||||
break;
|
break;
|
||||||
case 'MailPoet':
|
case 'MailPoet':
|
||||||
$mailerInstance = new $mailer['class'](
|
$mailerInstance = new $mailer['class'](
|
||||||
$mailer['api_key'],
|
$mailer['mailpoet_api_key'],
|
||||||
$fromEmail,
|
$fromEmail,
|
||||||
$fromName
|
$fromName
|
||||||
);
|
);
|
||||||
|
@@ -173,10 +173,8 @@
|
|||||||
type="text"
|
type="text"
|
||||||
class="regular-text"
|
class="regular-text"
|
||||||
id="mailpoet_api_key"
|
id="mailpoet_api_key"
|
||||||
name="mta[api_key]"
|
name="mta[mailpoet_api_key]"
|
||||||
value="<% if(settings.mta_group == 'mailpoet')%>
|
value="<%=- settings.mta.mailpoet_api_key -%>"
|
||||||
<%=- settings.mta.api_key -%>
|
|
||||||
<% endif %>"
|
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -512,11 +510,8 @@
|
|||||||
type="text"
|
type="text"
|
||||||
class="regular-text"
|
class="regular-text"
|
||||||
id="settings[mta_api_key]"
|
id="settings[mta_api_key]"
|
||||||
|
|
||||||
name="mta[api_key]"
|
name="mta[api_key]"
|
||||||
value="<% if(settings.mta_group == 'smtp') %>
|
value="<%=- settings.mta.api_key -%>"
|
||||||
<%=- settings.mta.api_key -%>
|
|
||||||
<% endif %>"
|
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -741,8 +736,10 @@
|
|||||||
var data = $('#mailpoet_settings_form').serializeObject();
|
var data = $('#mailpoet_settings_form').serializeObject();
|
||||||
// get test email and include it in data
|
// get test email and include it in data
|
||||||
var recipient = $('#mailpoet_mta_test_email').val();
|
var recipient = $('#mailpoet_mta_test_email').val();
|
||||||
// get currently selected method
|
|
||||||
var method = getMethodFromGroup(
|
var settings = jQuery('#mailpoet_settings_form').serializeObject();
|
||||||
|
var mailer = settings.mta;
|
||||||
|
mailer.method = getMethodFromGroup(
|
||||||
($('.mailpoet_sending_method:visible').data('group') !== undefined)
|
($('.mailpoet_sending_method:visible').data('group') !== undefined)
|
||||||
? $('.mailpoet_sending_method:visible').data('group')
|
? $('.mailpoet_sending_method:visible').data('group')
|
||||||
: $('#mta_group').val()
|
: $('#mta_group').val()
|
||||||
@@ -752,10 +749,11 @@
|
|||||||
endpoint: 'mailer',
|
endpoint: 'mailer',
|
||||||
action: 'send',
|
action: 'send',
|
||||||
data: {
|
data: {
|
||||||
|
mailer: mailer,
|
||||||
newsletter: {
|
newsletter: {
|
||||||
subject: "<%= __('Sending method test.') %>",
|
subject: "<%= __('Sending method test.') %>",
|
||||||
body: {
|
body: {
|
||||||
html: '',
|
html: "<%= __('Yup, it works. You can start blasting away emails to the moon.') %>",
|
||||||
text: "<%= __('Yup, it works. You can start blasting away emails to the moon.') %>"
|
text: "<%= __('Yup, it works. You can start blasting away emails to the moon.') %>"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -765,6 +763,12 @@
|
|||||||
email: recipient
|
email: recipient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}).done(function(response) {
|
||||||
|
if(response.result === true) {
|
||||||
|
MailPoet.Notice.success("The email has been sent! Check your inbox.");
|
||||||
|
} else {
|
||||||
|
MailPoet.Notice.error("The email could not be sent. Please check your settings.");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user