Forums

Emailing attachments

pete 08 Mar, 2015
Hi
I have a form with a checkbox group containing something similar to
fn_1=description_1
...
fn_n=description_n


I have a setup with custom code


[code]Array
(
[chronoform] => doggycentreadvice
[event] => submit
[checkbox] => advice_puppy_health,advice_separation
[name] => xxx yyyy
[email] => xxx@superpan.org
[subject] => Advice Sheet
[message] => Hi xxx
......
.....
[chrono_security_answer] =>
[submit] => Submit
[file_array] => /home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_puppy_health.pdf,/home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_separation.pdf
[ip_address] => 82.1.167.172
)
No errors

Array
(
[6] => Array
(
[Check Security Question] => Array
(
[0] => Passed the answer check!
)

)

[1] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:xxx@doggycentre.com
[2] => Subject:Advice Sheet
[3] => From name:Doggy Centre Admin
[4] => From email:xxx@doggycentre.com
[5] => CC:
[6] => BCC:
[7] => Reply name:xxx
[8] => Reply email:xxx@superpan.org
[9] => Attachments:
[10] => Array
(
)

[11] => Body:
<table>
<tr><td>Advice</td><td>[b]advice_puppy_health,advice_separation[/b]</td></tr>
<tr><td>Name</td><td>xxxx</td></tr>
<tr><td>Email</td><td>xxx@superpan.org</td></tr>
<tr><td>Subject</td><td>Advice Sheet</td></tr>
<tr><td>Message</td><td>[b]Hi xxx[/b]<br />
<br />
Please find the attached advice sheet(s) for you information.<br />
</td></tr>
<tr><td></td><td></td></tr>
</table><br /><br />IP: 82.1.167.172
)
)
)[/code]


I have several questions...

1) How do I get the [b]file_array[/b] to be emailed ?
I have {file_array} in the email attachments

2) How do I get the description_n in to the email rather than fn_n

3) From the name field, how do I pick up the first word of the name field to use as part of a greeting?

4) Is there a simple way to verify the files exist before emailing? Do I have the correct root for files to be attached?

Sorry to ask so many questions but I have been struggling and I am a noob with Joomla, php and chronforms.

Cheers...
Pete
pete 15 Mar, 2015
Hi can anyone help point me in the right direction?
Cheers...
Pete
GreyHead 16 Mar, 2015
Hi Pete,

1. Put file_array in the Email attachements box - without the curly brackets.

2. Please see this FAQ

3. You have to use a Custom Code action to extract the first part of the name and add it to the $from->data array. Better to use two inputs for the name and join them up again fif you want the whole name

4. ChronoForms will only attach files that have been successfully uploaded.

Bob
pete 17 Mar, 2015
Hi Bob,
Thanks for the reply.

1, I have done that so attachment files now contains file_array that but still not working
2. That's what I based the code on in the first place although I missed the explode.
3. Sorted using explode of name and picking up first entry
4. Not sure what that means. Does that mean it will NOT handle a file already existing on the server?

I have added a file check to ensure the file exists and tested bad file - all ok
The received email (without attachments) has everything working (as far as I have got)

Array
(
    [chronoform] => doggycentreadvice
    [event] => submit
    [checkbox] => 4,10
    [name] => Pete Miller
    [email] => pete@superpan.org
    [subject] => Advice Sheet(s)
    [message] => Hi Pete,

Please find attached data sheet(s):

-- Advice on Kennel Cough
-- Socialisation Chart


/home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_kennel_cough.pdf, /home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_socialisation_chart.pdf


I hope you find the attached information useful.

-- 
The Doggy Centre


    [chrono_security_answer] => 
    [submit] => Submit
    [file_array] => /home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_kennel_cough.pdf, /home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_socialisation_chart.pdf
    [ip_address] => 82.1.167.172
)


Debug info...
Array
(
    [6] => Array
        (
            [Check Security Question] => Array
                (
                    [0] => Passed the answer check!
                )

        )

    [1] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:info@doggycentre.com
                    [2] => Subject:Advice Sheet(s)
                    [3] => From name:Doggy Centre Admin
                    [4] => From email:info@doggycentre.com
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:Pete Miller
                    [8] => Reply email:pete@superpan.org
                    [9] => Attachments:
                    [10] => Array
                        (
                        )

                    [11] => Body:
<table>
<tr><td>Not In Use</td><td></td></tr>
<tr><td>Advice</td><td>4,10</td></tr>
<tr><td>Name</td><td>Pete Miller</td></tr>
<tr><td>Email</td><td>pete@superpan.org</td></tr>
<tr><td>Subject</td><td>Advice Sheet(s)</td></tr>
<tr><td>Message</td><td>Hi Pete,<br />
<br />
Please find attached data sheet(s):<br />
<br />
-- Advice on Kennel Cough<br />
-- Socialisation Chart<br />
<br />
<br />
/home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_kennel_cough.pdf, /home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_socialisation_chart.pdf<br />
<br />
<br />
I hope you find the attached information useful.<br />
<br />
-- <br />
The Doggy Centre<br />
<br />
</td></tr>
<tr><td></td><td></td></tr>
</table><br /><br />IP: 82.1.167.172
                )

        )

)


email received...
Hi Pete,

Please find attached data sheet(s):

-- Advice on Kennel Cough
-- Socialisation Chart


/home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_kennel_cough.pdf, /home/superpan/public_html/doggycentre.com/images/pdf/staff/advice_socialisation_chart.pdf


I hope you find the attached information useful.

-- 
The Doggy Centre
pete 25 Mar, 2015
Still can not get attachments to work. Almost given uo now. It has to be something simple as I can get the path into the email.😟
This topic is locked and no more replies can be posted.