Hello,
I'm trying to send an email from a form with a file that already resides on the server as attachement. The attachement is a 'tems and conditions' file in PDF format, the form a booking reauest for a travel agency.
The default email action has the option to send a attachment by naming the field name (of the field typ file) . So, I created a file type field in the form and put it as 'hidden' to force the form to have a file field. I worked out the form and put a little bit of custom code in the actions:
With a debugger I see the value of form->data['attachment1'] is correctly filled after submit.
However, I do not get an email with the attachement. I tried a few things, like not specifying the absolute file path to the attachment file and placing it in the 'uploads' folder of the CF component. or filling in the filename as 'ghost' value in the field. I tried with and without handling the array. None worked.
I'm a bit out of options and thoughts. Anyone have an idea what I may be doing wrong?
Many thanks in advance from
Erik
I'm trying to send an email from a form with a file that already resides on the server as attachement. The attachement is a 'tems and conditions' file in PDF format, the form a booking reauest for a travel agency.
The default email action has the option to send a attachment by naming the field name (of the field typ file) . So, I created a file type field in the form and put it as 'hidden' to force the form to have a file field. I worked out the form and put a little bit of custom code in the actions:
<?php
$form->data['attachment1'] = '/absolute/server/path/to/file/terms-and-conditions.pdf';
?>
With a debugger I see the value of form->data['attachment1'] is correctly filled after submit.
However, I do not get an email with the attachement. I tried a few things, like not specifying the absolute file path to the attachment file and placing it in the 'uploads' folder of the CF component. or filling in the filename as 'ghost' value in the field. I tried with and without handling the array. None worked.
I'm a bit out of options and thoughts. Anyone have an idea what I may be doing wrong?
Many thanks in advance from
Erik