Greetings
I was wondering if the component allows you to send the email template as an attachment. My idea was, I was trying to make a sort of enrolment form that I'd like to print exactly as I want. Would get the data from the form then make an email template to look exactly as I want with logos and table cells.
If I send it like that it will just be a regular email and when I try to print all the email client junk will also appear around the email, details, or this and that. But if I could send it as an attachment and then open it in some word processor program then I could easily print it without a hitch.
Tell me what you guys think.
Thank you
Mori
Hi Mori,
You can build a file and add it as an attachment. The problem is deciding what kind of file to build. Ideally I think it would be a pdf (the most robust kind of formatted document) - but Joomla's support for PDFs is pretty poor (though the included library is very good). I noticed the other day that Jan has created a PhocaPDF tool but I haven't had time to see what it can do yet.
Bob
Hello Mr. Grey
Sending the template as pdf, now that would be perfection, but I reckon something like that is probably ways off. Phocapdf I reckon is able to create pdfs off some values you give it, but connecting it with chronos would be beyond my capabilities.
The email is being sent as html and received by gmail in this case and opened. I do not wish to complicate matters. If the email template is already done, having it sent as an attachment as is, html, shouldn't be that hard should it? Perhaps hacking the code to add a line somewhere?
I'm trying to go this route as it seems to be the easiest way to get a printable form out of the send but if your experience with the component advises otherwise, please point me in the right direction.
Thanks again.
Mori
Hi moriwenne,
Max has just posted in another thread about how to get a text file to attach. Try the same method with an html file.
Bob
I noticed it, thank you for the pointing. I was waiting for Max to get an answer from the other fellow for I had tried the code but also with no luck.
But let me keep this thread about a separate part of the issue. Let's say the code does work, my question is, how do I transform the email template I have into file in my upload directory so that the code can then pick it up to add to the array?
Thank you.
Mori
Hi Moriwenne,
The Html message is contained in a variable that used to be called $html_message but will now have a new name. You'll need to trap and save that to a file. The problem will be the timing as you need to catch it before it is completed. It may need a code hack to catch it at the optimal point - otherwise you can 'borrow' the code and re-build it.
Bob
Oh dear, that elusive optimal point🙂
My reasoning was as follows. When the user hits submit some part of the code is run and the last thing should be to send some variable to the email sender with the email. If I knew where that is I would just duplicate that variable and add it to the attachment array.
Of course one comes up with these theories without knowing the component and ultimately the solution ends up being much more complicated.
I fear that at this point I have no idea how to proceed.
Many thanks already for the mind exercices.
Mori
Hi moriwenne,
Just took a quick look at the new code and there is no convenient hook point. All the code to create and send the emails is in the file com_chronocontact/libraries/mails.php but it goes directly from read the template to send the email without any obvious point to intervene.
If you don't mind hacking the core code take a look around line 202 where the attachements are being set up. At that point the email body is in $email_body and you could probably join the two up.
Bob
Hi Bob.
I don't mind hacking the code at all. You can never expect to find components, modules, plugins to do every little thing that you need, hacking is often necessary.
I thank you the time you took in checking it out, the pinpointing should help a lot.
I'm now going through some option checking trying to find out why I'm not getting attachments on my email, I've read the forums, double checked this and that, successfully made a small test form that sent the attachments, the files are arriving at the upload directory and yet, my main big form, doesn't seem to want to attachments to the email. When I'm out of ideas I'll make a post somewhere.
All of this to say that when I get this hack done I'll post here so that it can benefit someone else in the future.
Thanks again
Mori
Hi Mori,
If you haven't already done so turn on DeBug in the General tab - that will show you the $_FILES array and the paths for the files that are being attached (or not) to the emails. Can help track down the problem.
Bob
Hi Mori,
I have answered in other post, another user deaddy64 confirmed that the code works so if we are going to continue this here then please post a reference to the other post of the code you used from there!
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.