Send email button in custom post type backend

Solved this using AJAX. Here is my updated code:

<?php
add_action('wp_ajax_quote_email_pdf', 'quote_email_pdf');

function quote_email_pdf()
{
    wp_mail( $to, $subject, $message, $headers, $attachments );

    die();
}
?>
<button class="button" id="downloadQuote">Send email</button>

<script>
jQuery(document).ready(function($){
  const fullName = $('#quoteFullName').text();
  const emailAddress = $('#quoteEmail a').text();

  $('#downloadQuote').click(function(e){
    e.preventDefault();
    $.ajax({
      url: sf_admin_ajax.sf_admin_ajax_url,
      type: 'POST',
      data: {
          action: 'quote_email_pdf',
          emailAddress: emailAddress,
          fullName: fullName
      },
      beforeSend: function() {
          $('.preloader-window').addClass('active')
      },
      success: function(data, textStatus, XMLHttpRequest) {
          $('.preloader-window').removeClass('active')
          console.log(data);
      },
      error: function ( MLHttpRequest, textStatus, errorThrown ) {
          $('.preloader-window').removeClass('active')
          console.log(errorThrown);
      }
    })

  })
});
</script>