• Resolved wail523

    (@wail523)


    Hello , i have this function who resent the woocommerce invoice to another email.

    it work normally but without the attachement , i want to include the pdf attachement to it how i do it , i searched a lot but no hope

     <?php if (isset($_POST['submit'])) {
                    function emailhtml( $order, $heading = false, $mailer ) {
    
                      $template = 'emails/invoice.php';
    
                    return wc_get_template_html( $template, array(
                   'order'         => $order,
                  'email_heading' => $heading,
                'sent_to_admin' => false,
                'plain_text'    => false,
                  'email'         => $mailer
                 ) );
                
                }
    
              // load the mailer class
                 $mailer = WC()->mailer();
    
                //format the email
                $recipient = $_POST['email'];
              $subject = __("Votre facture de chez viny culture!");
              $content = emailhtml( $order, $subject, $mailer );
             $headers = "Content-Type: text/html\r\n";
             //send the email through wordpress
             $mailer->send( $recipient, $subject, $content, $headers );
            }
    ?>

    Thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Attach pdf to custom email’ is closed to new replies.