I am trying to send an email inside a php script using PHPmailer, so I need the PHPmailer class which I included at the top of my page, I am 100% sure everything is correctly uploaded on my server.
My structure is like this:
root
- includes/addreviewscript.php
- phpMailer/class.phpmailer.php
I post data to that script using below jQuery ajax code:
// Post review
$("body").on("click",".add_review",function(){
event.preventDefault();
$reviewform = $(".addreview").serializeArray();
url = 'includes/addreviewscript.php';
var posting = $.post( url, { reviewarray: $reviewform} );
posting.done(function( data ) {
var content = $( $.parseHTML(data) );
$('[name="beoordeling"]').hide();
$('[name="submitreview"]').hide();
$('.beoordeeltekst').hide();
$( ".reviewresponse" ).empty().append( content ).slideDown();
});
});
That works, but in my addreviewscript.php
I then add this to the top:
include '../phpMailer/class.phpmailer.php';
And further down I add:
$mail = new PHPMailer;
$mail->From = 'info@mymail.nl';
$mail->FromName = 'website';
$mail->addAddress('twan@mymail.nl'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Er is een review geplaatst op website';
$texts = 'Hier komt de reviewtekst';
$mail->send();
But no mail is send and no error_log is generated. What could be the issue?