I'm using SweetAlert library from:
http://t4t5.github.io/sweetalert/
In detail, this alert box:
swal({
    title: "Are you sure?",
    text: "You will not be able to recover this imaginary file!",
    type: "warning",
    showCancelButton: true,
    confirmButtonColor: "#DD6B55",
    confirmButtonText: "Yes, delete it!",
    cancelButtonText: "No, cancel plx!",
    closeOnConfirm: false,
    closeOnCancel: false
},
function(isConfirm)
{
    if (isConfirm) 
        {
            <?php SendMail($to); ?>
            swal("Deleted!", "Your imaginary file has been deleted.", "success");
        }
    else
        {
            swal("Cancelled", "Your imaginary file is safe :)", "error");
        }
});
As you can see, SendMail is allways called. How could I do to call SendMail just if isConfirm is true?
Thanks you so much,
 
     
    