Hi i got this code no error in console but email dont come on my email. Php code :
<?php
require ('src/PHPMailer.php');
use \PHPMailer\PHPMailer\PHPMailer;
use \PHPMailer\PHPMailer\Exception;
function mail_attachment($from ,$to, $subject, $message){
$email = new PHPMailer();
$email->From = $from;
$email->FromName = $from;
$email->Subject = $subject;
$email->Body = $message;
$email->addAddress($to);
return $email->send();
}
//Sending
$email = 'XXX';
mail_attachment('XXX', $email, 'New email', 'New email');
header("Location: index.html");
?>
ajax:
$(document).ready(function(){
$(".submitform").on("click",function() {
var data = "XXX";
$.ajax({
url: 'send.php',
type: 'POST',
data: {
data: data
}
});
});
});
<button type="submit" class="btn btn-secondary text-danger submitform">SEND</button>
What I am doing bad ..? I am php noob so if you have any idea i will be grateful. Thank you.