PDA

View Full Version : Form Results as HTML Attachment



mseiferl
21-May-2010, 05:47 AM
I don't know whether this is a bug or not. I posted this in the Community Forum and a helpful user who appears quite knowledgeable with formmail tried to help but couldn't figure this out. So I don't know if I'm trying to do something formmail can't do or can do but isn't working as it should be (or perhaps I'm doing something wrong). In any event, I'll post it here and you can tell me if it's a bug or not.

I have the following fields in my form:

<input type="hidden" name="filter" value="null" />
<input type="hidden" name="filter_options" id="filter_options" value="Attach=App_Submission.html" />
<input type="hidden" name="mail_options" id="mail_options" value="HTMLTemplate=adopt_app.html,TemplateMissing=Blank,AlwaysList,NoPlain" />
But what I get in form results is an e-mail in which there is formatted results using my adopt_app.html template, an attachment called App_Submission.html but when I click on the attachment, it is simply an unformatted string of field names followed by a colon then the field result (no returns just one long string wrapping based on the size of your browser window). The source of the html is formatted only inasmuch as there are returns after each field. (All of this is posted in Community Forum if you need to see the results).

I initially tried to get a formatted html file attachment (using adopt_app.html) without the "NoPlain" property on the mail_options value but got the same results.

So is this a bug? Since I don't know formmail very well I can't judge. I'm going by the user that tried to help. And if it is a bug, well then I guess I'm reporting it here.

I would like to know though so I can tell if it's my problem or a formmail problem.

russellr
21-May-2010, 07:46 AM
Hi,

crabtree almost knows FormMail better than I do! :rolleyes:

I've checked his replies and they all make sense (but might not be correct, see below).

This definitely isn't a bug, but it might not be a feature that currently exists.

The area of "HTML vs Plain templates and what gets attached and what doesn't" is complex.

It's evolved over time and the implementation is really "what most people want". And, in this case, it really means "what most people who use our FormMailEncoder (encryption product) want".

In other words, we've implemented the default combination of these features so that if you're using:
a PlainTemplate, plus,
an HTMLTemplate, plus,
a filter,
and you've specified to attach the filtered results,FormMail will:
put the HTML (expanded template) in the body of the email
expand the Plain Template
filter the expanded Plain Template
attach the filtered output.From what I've read, you haven't specified a PlainTemplate. So, I'm not sure just at this minute exactly what FormMail is going to do.

From your description, you're getting plain text (without a template) attached, and the expanded HTML template in the email body.

That kind of makes sense given the defaults I've specified above.

Like crabtree, I'm going to have to run some tests to figure out if it's possible to achieve what you want.

My current guess is no. :( (but see below for a last-second idea!)

We've known for some time that this is such a complicated thing when you start piling on the features specified in your form.

And, we've been thinking about how to make it more flexible.

In your case, you want to say:
put plain text in the body (if any)
put HTML in an attachmentcrabtree suggested using our "null" filter to achieve this, but that's not working.

So, we need to come up with a way for your form to specify this to FormMail.

I've just had an idea.....

Leave everything unchanged, except replace "HTMLTemplate=" in your "mail_options" field with "PlainTemplate=".

So, you're going to lie to FormMail and tell it the HTML template you have is really a plain text template.

It shouldn't make much difference to the processing, but it might just make the HTML get attached.

If that doesn't work, then I think you'll have to wait until we add a new feature for explicitly controlling what goes where.

BTW, the other option is additional PHP code hooked into FormMail. But that's a fair amount of work.

mseiferl
21-May-2010, 08:08 AM
Woo hoo! It worked! Just wanted to post a response so that you knew and didn't have to go through the trouble of testing your theory out.

If you make future changes to formmail to specifically address this, should I be worried that the change I've now implemented will stop working?

In any event, THANK YOU! This takes a load off. I no longer have to figure out how to address my unique problem.

And in case crabtree is reading....thank you too for all your help!

russellr
21-May-2010, 11:16 AM
Hi,



Woo hoo! It worked! Just wanted to post a response so that you knew and didn't have to go through the trouble of testing your theory out.
Terrific! :D



If you make future changes to formmail to specifically address this, should I be worried that the change I've now implemented will stop working?
It probably won't stop working. But, whenever you grab an upgrade, you always have to test.