Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Email attachments to confirmation


11 replies to this topic

#1 robguay

  • Community Member
  • 74 posts
  • Real Name:Robert J Guay Jr
  • Gender:Male
  • Location:Sterling Heights Michigan

Posted 11 August 2008, 20:29

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:

#2 FIMBLE

  • Community Member
  • 6,567 posts
  • Real Name:Nic
  • Gender:Male

Posted 11 August 2008, 21:27

There is already a contribution for this.
search the contributions for PDF
Nic
Sometimes you're the dog and sometimes the lamp post

My Contributions

#3 robguay

  • Community Member
  • 74 posts
  • Real Name:Robert J Guay Jr
  • Gender:Male
  • Location:Sterling Heights Michigan

Posted 11 August 2008, 21:41

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.

#4 robguay

  • Community Member
  • 74 posts
  • Real Name:Robert J Guay Jr
  • Gender:Male
  • Location:Sterling Heights Michigan

Posted 12 August 2008, 13:50

1

#5 Black Jack 21

  • Community Member
  • 81 posts
  • Real Name:Andreas
  • Gender:Male
  • Location:Germany

Posted 13 August 2008, 13:40

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

#6 robguay

  • Community Member
  • 74 posts
  • Real Name:Robert J Guay Jr
  • Gender:Male
  • Location:Sterling Heights Michigan

Posted 13 August 2008, 14:14

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

#7 robguay

  • Community Member
  • 74 posts
  • Real Name:Robert J Guay Jr
  • Gender:Male
  • Location:Sterling Heights Michigan

Posted 13 August 2008, 14:40

This works perfect.

Again THANK YOU VERY MUCH!

#8 lee987

  • Community Member
  • 22 posts
  • Real Name:Lee Stanley

Posted 24 January 2010, 15:25

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.

#9 onkeljan

  • Community Member
  • 22 posts
  • Real Name:Bjørn Ove

Posted 04 January 2011, 13:30

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?

#10 onkeljan

  • Community Member
  • 22 posts
  • Real Name:Bjørn Ove

Posted 04 January 2011, 13:32

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

#11 onkeljan

  • Community Member
  • 22 posts
  • Real Name:Bjørn Ove

Posted 04 January 2011, 13:42

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

#12 Zahoor

  • Community Member
  • 23 posts
  • Real Name:ZA
  • Gender:Male
  • Location:Norway

Posted 16 March 2011, 12:20

I am using a contribution by name: Fancier Invoice & Packing slip.
I dont know where to make necessary changes so that I can attach pdf. Could someone have a look at the contribution and guide me in right direction?

Edited by Zahoor, 16 March 2011, 12:21.