Static mail attachment? Is it possible?

byran 27 Jun, 2010
I need to have the people who fill out one of my forms, 3 file attachments. The file attachments will not change, and need to be sent to every person who fills out the form. Is it possible to do this? I've looked at so many potential solutions, but their learning curve is atrocious. Help!
GreyHead 28 Jun, 2010
Hi Bryan,

That needs a little code in the OnSubmit before box but it is entirely possible. Search here on attachment and you should find it.

Bob
byran 28 Jun, 2010
Well... I found the code, thank you. Problem is: it looks like the code prevents emails being sent to dynamic addresses. If I provide a static "to", it works. Dynamic "to" does not. How do I fix that?

For the record, here is the code🙂

<?php
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments[] = 'files/vendorlist.pdf';
?>


BTW- you can send multiple attachments by duplicating the last line and changing the file name like this:
$MyUploads->attachments[] = 'files/vendorlist.pdf';
$MyUploads->attachments[] = 'files/another_one.pdf';
byran 29 Jun, 2010
Any thoughts? The code ONLY works for static "to" addresses, and I need to have it work for dynamic "to" addresses. I'm hoping it's just a little tweak🙂
GreyHead 29 Jun, 2010
Hi Byran,

I can't see any reason why that code would have any affect at all on Dynamic To addresses. What do you have in the Dynamic To box?

Bob
byran 29 Jun, 2010
Thanks for the reply, Bob—the form collects their email and stores it with <... id="text_7" name="email_to" ...>. So in the Dynamic To box, I have "email_to" (sans quotes). No matter how many times I do it, I don't get an email sent unless it's a static "to". I can't really think of how else to troubleshoot this, either. Can you?

UPDATE: just tested it on another form, and it works. That's... odd. The original form still won't send it, however. Too strange.
GreyHead 30 Jun, 2010
Hi byran,

Turn Debug on for the form and see if the 'dummy' emails in the Debug info give you any clues.

Bob
byran 30 Jun, 2010
Didn't even realize there WAS a debug mode! Of course everything works normally now, with all the files going where they should. So, so, so, so odd. At any rate, thank you very much for your help.
This topic is locked and no more replies can be posted.