Forums

Dynamic Attachments in Emails

Gekko23 17 Sep, 2008
Hi,

i am currently working on a solution to get PDFs (Rokdownloads) sent to an email adress the visitor enters (ChronoForms).
I'm still inside the Rokdownloads Component to make the "DOWNLOAD" button disappear and a ChronoForms form to be placed instead. This is working perfectly, but because of security issues the form code has to translate a cryptic document id (search in database) into the correct document path and send the result to the given adress.

As i try to avoid any hardcoded changes inside the core files of any component, i am not really sure how to realize this issue by using the appropriate default input fields inside the ChronoForms component. But i AM sure, that it could be realized by doing so.

Could someone give me a hint on how to approach this?
I really don't know how to send an attachment (PDF) by using an email template (ChronoForms backend)...especially in the code & syntax point of things.

Many thanks for any help,
Gekko =)
Max_admin 17 Sep, 2008
Hi Gekko,

Can you get the absolute path of the files somehow ? if so then at the onsubmit before email you can add the paths to the attachments array and they will get attached..
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Gekko23 17 Sep, 2008
Yes, the absolute path can be successfully provided by enhancing the "AutoGenerated Code" in the backend...can you be more specific on what has to be done if the path is given? Does the plain insertion of the variable (carrying the target URL) in the "On Submit Before Email" tab hit the goal? How is this to be done precisely?


// assuming this is the result of the "AutoGenerated Code" tab code:
$path = this/is/the/way/to/go.pdf

// does this lead to an generated attachment in the "OnSubmit Before Email":
<?php 
$path;
?>


I don't know exactly how to do it, especially if there are PHP commands to be used for this to work.

Thanks for your help,
Gekko =)

Btw: i can assure you to buy a license shortly. I'm absolutely amazed about your component...the possibilities seem endless! Thank you VERY much for it!
Max_admin 17 Sep, 2008
Hi Gekko,

if you can feed the form with the file path somehow then at the onsubmit before email box you can writ this code :

<?php

$attachments['file1'] = PATH TO FILE;

?>

let me know

Cheers

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Gekko23 17 Sep, 2008
Thank you, that slightly enlights this issue for me.

But below the line i have a general question regarding the validity of variables and parameters through the PHP including tabs of ChronoForms to be able to understand what is possible with the component: Is there a stability for defined values (let's say in this case i define a variable $path=/path/to.pdf). is this variable valid through the whole process of ChronoForms and can it be used in every PHP call inside ChronoForms backend tabs or does it keep its value just inside its (origin) tab?

In either case is it right that the following structure can be assumed for the sequential order of processing PHP code:
"AutoGenerated code" -> "Form Code/Onsubmit BEFORE email" -> "Form Code/Onsubmit AFTER email"?
And if so, can the $path variable once defined in "AutoGenerated Code" be continuously used in any further processed code?

I have my roots in Flash's ActionScript and Sandbox structures, so please don't mind if my questions sound ridiculous in terms of logics of PHP...

Thanks,
Gekko =)
Max_admin 18 Sep, 2008
Hi Gekko,

we don't play with the "AutoGenerated code", always with the couple onsubmit code boxes, so the before submit gets executed before the email, and if there are no emails setup then it will not get executed actually, the email attachment are defined in an array called $attachments, the array values should be absolute paths to files, so this is what we are trying to achieve, inject the paths into the array before the email is sent.

Regards

Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
almas 25 Nov, 2008
Hello,

I am in problem something like this. But a little bit different.

That is: I need to attach a doc file but that is after submitting a form and that form html should be converted to doc file then do it as attachment.

Does it make sense?

Please help me regarding this issue.

Thanks

Almas
Max_admin 25 Nov, 2008
Hi Almas,

you need the form HTML with the data entered by the user or need it empty ? in the mean time you can look at google for how to use PHP fwrite function to write a file somewhere on your server because we will need this!

Regards
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.