X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Plain text email plus HTML attachment (https://forum.x-cart.com/showthread.php?t=4404)

John_E 09-19-2003 03:03 AM

Plain text email plus HTML attachment
 
Hi,

Has anyone coded a mod to xcart that uses one template as the plain text template, then writes a file as an attachment using the other template which is HTML coded?

So when the email is sent from xcart the plain text comes up, and also a html version is attached to the text email?

Just curious, as I think it would be good to suit all customers, both those with just plain text and those with html mail programs.

It would also be a great mod for xcart to put in their future versions.


John_E :wink:

(Dream interpreter - Have dream, will interpret)

B00MER 09-19-2003 06:22 AM

Code:

// attachments
 if($AttmFiles){
  foreach($AttmFiles as $AttmFile){
  $patharray = explode ("/", $AttmFile);
  $FileName=$patharray[count($patharray)-1];
  $Msg.= "\n--".$OB."\n";
  $Msg.="Content-Type: application/octetstream;\n\tname=\"".$FileName."\"\n";
  $Msg.="Content-Transfer-Encoding: base64\n";
  $Msg.="Content-Disposition: attachment;\n\tfilename=\"".$FileName."\"\n\n";
           
  //file goes here
  $fd=fopen ($AttmFile, "r");
  $FileContent=fread($fd,filesize($AttmFile));
  fclose ($fd);
  $FileContent=chunk_split(base64_encode($FileContent));
  $Msg.=$FileContent;
  $Msg.="\n\n";
  }
 }


The files are attached by an array specified.
$attmFile = Array("/home/sites/blah.com/attachment.jpg");

Found this on www.php.net/mail, sure it could be integrated into include/func.php for what's needed to attach files to the email's sent.

John_E 09-22-2003 02:50 AM

Dynamic attachment files
 
Thanks for the reply Boomer,

Are we talking dynamic attachment files?

The xcart would need to send the email according to the template, then generate another email, html version, including product code, quanity, price, if invoice for example, or customer data if lost password.

It wouldnt be the same file attachment each time, it would need to generate the attachment file on the fly, call it perhaps Attn: 0001.htm and then attach it to the email.



John_E :wink:

(Dream interpreter, have dream, will interpret)


All times are GMT -8. The time now is 08:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.