Send pdf invoce with confirmation
Change-Id: Ie5b7b20043d11879f758af6536b55961314188eb
diff --git a/mail.php b/mail.php
index c0f3251..3a0440f 100755
--- a/mail.php
+++ b/mail.php
@@ -2,8 +2,10 @@
require_once "Mail.php";
include('Mail/mime.php');
include 'config.php';
+include_once 'User.php';
+use \User as User;
-function send_mail(string $email, object $smtp, object $message) {
+function send_mail(string $email, object $smtp, object $message, User $user = null) {
include 'config.php';
$crlf = "\r\n";
@@ -41,6 +43,9 @@
// Setting the body of the email
$mime->setTXTBody($message->text);
$mime->setHTMLBody($message->html);
+ if ($user && $user->invoice) {
+ $mime->addAttachment ( $user->invoice , 'application/pdf' , $SERVICE_ACRONYM."-invoice.pdf" , false, "base64" );
+ }
$body = $mime->get();
$headers = $mime->headers($headers);