Zen Cart Logo
Forums / General Questions / Attaching files in emails (order confirmation)

Attaching files in emails (order confirmation)

Locked

Views: 2,300

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
30 Oct 2009, 9:27 AM
#1
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Attaching files in emails (order confirmation)

I have a customer who wants a standard looking bank transfer document sent as a PDF with the order confirmation email for customers that selected to pay in advance using bank transfer.

Now I have the code ready from another similar project that produces the PDF ... now the question is, how do I attach it to the email?

I'm not too familiar with the zencart mailing system. Does it have a function to add attachements, or do I need to edit the email system core to achieve this?

And the customer wants it attached, not as a link which would be easy to make.

Any help welcome, thanks! :smile:

30 Oct 2009, 5:40 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Attaching files in emails (order confirmation)

Is the PDF a static file, sitting on the server? Or is it something to be custom generated on-the-fly?
What version of Zen Cart?

30 Oct 2009, 9:35 PM
#3
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Attaching files in emails (order confirmation)

DrByte:

Is the PDF a static file, sitting on the server? Or is it something to be custom generated on-the-fly?
What version of Zen Cart?

Saved on the server as a file after it has been created with fpdf on the fly :D

The fpdf part is all set up to create the PDF file (I used this on my own shop some year ago), but just need to know how to attach the file automatically to the out going confirmation email.

1.3.8 (latest patch version)

30 Oct 2009, 9:39 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Attaching files in emails (order confirmation)

2 Questions:

  • How/when is your FPDF script called/triggered? Are you hard-coding something? Are you using observer/notifiers? etc? (Or maybe not doing anything yet?)

  • When it generates its output, does it need to save the output as a file? Or can it return the raw file content as the result of calling the code/function you've written?
    It's a little simpler and safer to not have to write the output to a file on the server's filesystem.

2 Nov 2009, 12:23 PM
#5
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Attaching files in emails (order confirmation)

  1. Not doing anything yet, since the customer wants to know how much it will cost and I'm not doing anything untill they approve it. Maybe using notifiers, but haven't looked into it so much. The system I had in my own shop just called 1 function inside the bank transfer module to create the pdf, which was then linked to the customer.

  2. if it can be done so no files need to be saved, all the better! I'm not that familiar with all these email coding things when it comes to sending attachments.

2 Nov 2009, 12:30 PM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Attaching files in emails (order confirmation)

Generally not a good idea to attach large files to outgoing emails. Why not just put a link to the pdf (resident on your server) into the email?

3 Nov 2009, 5:35 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Attaching files in emails (order confirmation)

pasi:

... The system I had in my own shop just called 1 function inside the bank transfer module to create the pdf, which was then linked to the customer.
Does it need to be generated by the payment module? Or can it be triggered some other way?
What exactly is being customized in it that requires on-the-fly generation? Is it something only available inside the payment module? Or can it be gleaned from the order record itself?
What other payment modules are enabled on the site?

10 Nov 2009, 12:40 PM
#8
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Attaching files in emails (order confirmation)

schoolboy:

Generally not a good idea to attach large files to outgoing emails. Why not just put a link to the pdf (resident on your server) into the email?

Yes, this would be the preferred method.... Feel free to argue this with my customer though. They want it attached (period).

:laugh:

10 Nov 2009, 12:45 PM
#9
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Attaching files in emails (order confirmation)

DrByte:

Does it need to be generated by the payment module? Or can it be triggered some other way?
What exactly is being customized in it that requires on-the-fly generation? Is it something only available inside the payment module? Or can it be gleaned from the order record itself?

No it doesn't need to be generated in the module, it is just the way I implemented it in my own shop when I used the pdf creation system.
it can be generated with a function that has order number available (all the data can be extracted from the database with the order number). The file CAN be saved on the filesystem and then attached too.

DrByte:

What other payment modules are enabled on the site?

There is only a custom COD module (made by me) besides the banktransfer module'in the customers shop.

and sorry for the late responses.... very busy here :wacko: