fetch ("01012D0846", $vars, "(\d+)", "rechnum"); $p2f->fetch ("0102410846", $vars, "(\d+)", "kndnum"); $p2f->fetch ("01036C00C6", $vars, "(.*)", "kndname"); $p2f->fetch ("01050A0229", $vars, "(.*)", "kndmail"); $p2f->fetch ("0102860846", $vars, ".+ (\d+)", "auftrnum"); $p2f->fetch ("0101720846", $vars, "(\d\d\.\d\d\.\d{4})", "rechdatum"); /* PDF file creation with supplied meta data */ $pdf = $p2f->createpdf ("$spool\\$document.pcl", "Lieferant GmbH", "Rechnung {$vars ["rechnum"]}", "{$vars ["rechnum"]}; {$vars ["rechdatum"]}; {$vars ["kndnum"]}"); if ($pdf != "") /* pdf creation successful */ { $data = array ( "from" => "info@lieferant-gmbh.local", "fromname" => "Buchhaltung Lieferant GmbH", "to" => $vars ["kndmail"] "toname" => $vars ["kndname"], // "cc" => "", // "ccname" => "", "file" => $pdf, "filename" => "Rechnung {$vars ["rechnum"]}.pdf", "subject" => "Lieferant GmbH - Rechnung {$vars ["rechnum"]}", "body" => $p2f->substitute ("Sehr geehrte Damen und Herren,

" . "vielen Dank für Ihren Auftrag @auftrnum@.

" . "Mit dieser Mail erhalten Sie dazu unsere Rechnung @rechnum@
" . "mit Datum vom @rechdatum@ im Format PDF/A.

" . "Mit freundlichen Grüßen
" . "Ihre Lieferant GmbH


" . "Lieferant GmbH
" . "Lieferweg 21
" . "80345 Musterstadt

" . "Tel.: +49 1234 1234-0
" . "Fax: +49 1234 1234-123

" . "Mail: info@lieferant-gmbh.local

" . "Geschäftsführer: A. Mustermann
" . "Registergericht Musterstadt: 5 HRB 12345
" . "USt-IdNr.: DE123456789
", $vars) ); $em = new email ("server", 465, "user", "password"); if ($em->sendmail ($data, $message) == 0) $p2f->error ("Sending e-mail failed '$message'", 0); } else $p2f->error ("No document available for e-mail", 0); if ($p2f->errorsfound () != 0) exit (-1); ?>