Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Email attachments to confirmation


robguay

Recommended Posts

Posted

Is there a contribution that always me to send an attachment with the confirmation email.

 

Or how do I use this function to acheive it?

 

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

Something like this

 

var $attachment_to_be_Sent = 'docs/mypdf.pdf';

 

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $attachment_to_be_Sent);

:blink:

Posted

The only mod that I could find is a mod that will allow you to email attachments through the admin panel.

 

I need the attachment to be sent at the end of their order process, attached to the email confirmation.

Posted

Hi, i've found a solution in the german forum. I use it a little bit modified.

 

includes/languages/XXX/checkout process.php

 

add

//BOC e-mail with attachment
 function tep_mail_pdf_anhang($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $file, $filetype) {
   if (SEND_EMAILS != 'true') return false;

if (eregi('Content-Type:', $to_name)) return false;
if (eregi('Content-Type:', $to_email_address)) return false;
if (eregi('Content-Type:', $email_subject)) return false;
if (eregi('Content-Type:', $email_text)) return false;
if (eregi('Content-Type:', $from_email_name)) return false;
if (eregi('Content-Type:', $from_email_address)) return false;
if ( (strstr($to_name, "\n") != false) || (strstr($to_name, "\r") != false) ) return false;
if ( (strstr($to_email_address, "\n") != false) || (strstr($to_email_address, "\r") != false) ) return false;
if ( (strstr($email_subject, "\n") != false) || (strstr($email_subject, "\r") != false) ) return false;
if ( (strstr($from_email_name, "\n") != false) || (strstr($from_email_name, "\r") != false) ) return false;
if ( (strstr($from_email_address, "\n") != false) || (strstr($from_email_address, "\r") != false) ) return false;

   $message = new email(array('X-Mailer: osCommerce Mailer'));

   $text = strip_tags($email_text);
   if (EMAIL_USE_HTML == 'true') {
     $message->add_html($email_text, $text);
   } else {
     $message->add_text($text);
   }
  $attachment = fread(fopen($file, "r"), filesize($file));
  $message->add_attachment($attachment, TEXT_NAME_OF_CONDITIONS, $filetype);
//   $message->add_html_image($file_content, $file);

   $message->build_message();
   $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
 }
//EOC e-mail with attachment

 

checkout_process.php

find

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

replace with

tep_mail_pdf_anhang($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, DIR_WS_LANGUAGES . $language . "/" . "conditions.pdf", "application/pdf");

 

Drop a PDF named "conditions.pdf" to your language folder.

 

Please comment!

 

Black Jack 21

Posted

Thank you very much. I will impliment it today. I will get back with you with the results.

:D

  • 1 year later...
Posted

Very useful little add on, which does work if I have 'Use MIME HTML when sending emails' set to False. If it is set to true it does not work on my install. Anyone else found this? Thanks.

  • 11 months later...
Posted

Works fine, exept that it says "TEXT_NAME_OF_CONDITIONS" in the email. I have of course tried to change it, but it will not change in the email.

 

I have also tried to add the line:

define('TEXT_NAME_OF_CONDITIONS', 'Angreskjema');

 

in the language file.

 

What can i do?

Posted

"Use MIME HTML when sending emails" does not make any difference here.

Posted

DOH. Uploaded the wrong document. Works fine now :)

  • 2 months later...

Archived

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

×
×
  • Create New...