PDF is being generated but it does not be attached with email although email does not send.

69 views
Skip to first unread message

A Kareem

unread,
May 14, 2012, 8:29:56 AM5/14/12
to dompdf
hello,

I am using this code to generate the PDF and attachment that PDF to
the email.

PDF is being generated but it does not be attached with email although
email does not send.


require_once("dompdf/dompdf_config.inc.php");
require_once("mime.php");

$html =
"<html><body>".
"<table> <tr> <td>First Name:</td><td>$fname</td> </tr>
<tr><td>Last Name:</td><td>$lname</td></tr>
<tr><td>Contact Number</td><td>$contact</td></tr>
<tr><td>Email:</td><td>$email</td></tr>
<tr><td>Message:</td><td>$message</td></tr>
</table>".
"</body></html>";

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
file_put_contents("path/to/$fname.pdf", $dompdf->output());



$headers['To'] = 'imran....@hotmail.com';
$headers['Subject'] = 'PDF File email';
$mime = new Mail_mime();
$mime->setTXTBody('email body text');
$mime->addAttachment('path/to/sample.pdf');
$body = $mime->get();
$headers = $mime->headers($headers);
$mail =& Mail::factory('mail');
$mail->send('nor...@imran.com', $headers, $body);



Please help me this regard,

Thank you,

Imran

Dave

unread,
May 14, 2012, 4:04:57 PM5/14/12
to dom...@googlegroups.com
Where is the $fname variable being set?  You are saving the contents of the PDF using that variable name but trying to attach a hard coded name of sample.pdf.
Reply all
Reply to author
Forward
0 new messages