Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

pdf email attachment


kdb

Recommended Posts

Hi..

 

I really need some help with this. I have, or soon will have, quite a lot of free pdf documents available and I want to collect qualified email addresses of those who download them.

 

To do this, I show them a small preview and then if they want them they go to a form which collects the email and then sends them the file.

 

My problem is that when it reaches the destination, Acrobat says the file is corrupt and may have been included as an attachment (of course it has) and has not been decoded properly. The file size in the attachment bar is correct but if save to disk, the file size is 0kb.

 

I modified the tep_mail function to :

 

    function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $attachment_file=false, $attachment_name=false, $attachment_type=false) {
   if (SEND_EMAILS != 'true') return false;

   // Instantiate a new mail object
   $message = new email(array('X-Mailer: osCommerce Mailer'));

if ($attachment_file != false && $attachment_name != false && $attachment_type != false) {
      $attachments = $message->get_file($attachment_file);
      $message->add_attachment($attachments, $attachment_name, $attachment_type);

}

   // Build the text version
   $text = strip_tags($email_text);
   if (EMAIL_USE_HTML == 'true') {
     $message->add_html($email_text, $text);
   } else {
     $message->add_text($text);
   }

 

Please can any one help me.

 

Thanks

 

KdB

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...