Reputation: 643
I have successfully setup the WP SMTP Mail plugin - test emails (from the plugin setup page) come through no problem.
I'm now trying to send a simple email from Javascript from a page on the same WordPress site. The code is:
<script>
function sendEmail() {
var data = {
'to': '[email protected]',
'subject': 'Hello',
'message': 'Hello, world!'
};
jQuery.post('/wp-admin/admin-ajax.php?action=wp_smtp_mail_send', data)
.done(function(response) {
console.log('Email sent successfully.');
})
.fail(function(error) {
console.log('Error sending email.');
});
}
sendEmail();
</script>
It returns: Error sending email.
Can you see anything wrong with my code?
Thanks, Mark
Upvotes: 0
Views: 216