2){ $client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4); } $client_website = $row['client_website']; ?> SMTPDebug = 2; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $config_smtp_host; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $config_smtp_username; // SMTP username $mail->Password = $config_smtp_password; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = $config_smtp_port; // TCP port to connect to //Recipients $mail->setFrom($config_mail_from_email, $config_mail_from_name); $mail->addAddress("$client_email", "$client_name"); // Add a recipient // Attachments //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name // Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = "Invoice $invoice_number - $invoice_date - Due $invoice_due"; $mail->Body = "Hello $client_name,

Thank you for choosing $config_company_name! -- attached to this email is your invoice in PDF form due on $invoice_due Please make all checks payable to $config_company_name and mail to $config_company_address $config_company_city $config_company_state $config_company_zip before $invoice_due.

If you have any questions please contact us at the number below.

~
$config_company_name
Automated Billing Department
$config_company_phone"; //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; mysqli_query($mysqli,"INSERT INTO invoice_history SET invoice_history_date = CURDATE(), invoice_history_status = 'Sent', invoice_history_description = 'Emailed Invoice!', invoice_id = $invoice_id"); mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Sent', client_id = $client_id"); $_SESSION['alert_message'] = "Invoice has been sent"; header("Location: invoice.php?invoice_id=$invoice_id"); } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?>