Send Invoice in email Generate invoice and send it via email

You can generate invoice and send it as attachment in email. All you need to do is call the sendEmail function. You can define the subject, message, from, cc, bcc information in sendEmail function.

  
                            $xinvoice = new Xinvoice();
                            /**
                             * Set email related settings for xInvoice
                             * @param   array   $to                            To email
                             * @param   string   $subject                       Subject of email
                             * @param   string   $message                       Message of the email
                             * @param   array   $from                          From email
                             * @param   string   $cc                            CC email
                             * @param   string   $bcc                           BCC email
                             * return   object                                  Object of class
                             */
                            $xinvoice->sendEmail(array("to_email@gmail.com"),"Invoice Subject", "Attached Invoice message",
                                array("from_email@tech.com"));
                            $xinvoice->setSettings("output", "F");//output type must be F to send as attachment
                            echo $xinvoice->render();