Forums

how to attach file to email automatically

Mushr00m 15 May, 2010
Hello !

I just want to attach automatically a doc file to an email. The user has nothing to upload, it's just an automatic attached file to the email that I need. Is it possible ?

Thank you
Mushr00m 15 May, 2010
So I found out how to attach file with this code :

<?php
$MyForm =& CFChronoForm::getInstance('MyForm');
$form_id = $MyForm->formrow->id;
$MyUploads =& CFUploads::getInstance($form_id);
$MyUploads->attachments [] = 'images/stories/MyFile';
?>


But the thing is, I need this file to be sent to one of my two email adresses (one is a notification to me that somebody fill out the form and another is to the user, it's this one who need the file attached). I had the idea to use a IF condition with the "to" email adress but I don't know how to catch it ?

Thank you
GreyHead 19 May, 2010
Hi MushRr00m,

Create two Email Setups one for you and the other for the user and only enable Attachments on the one for the user.

Bob
Mushr00m 19 May, 2010
Thanks a lot !

Works perfectly !

PS : Is it possible to change my pseudo ? When I register on the forum I enter "MushRr00m" instead of "Mushr00m".
GreyHead 19 May, 2010
Hi Mushr00m,

I've changed your name - you'll need to use the new version to log in again.

Bob
Mushr00m 19 May, 2010
Once again....Thank you !
Tonop 18 Apr, 2011
Hi!

It does not work for Joomla 1.6 version.
There is no CFUploads class.
Anybody know hot to attach file in 1.6 version?

Thanks,
Boris
GreyHead 19 Apr, 2011
Hi Boris,

There are several posts about this in the ChronoForms v4 forum here.

Bob
GreyHead 21 Apr, 2011
Hi Boris,

My aplogies, I was rushing through a backlog of posts and misread yours. I don't know how to do this in CFv4; I'll try to work it out when I have some time.

Bob
Tonop 22 Apr, 2011
Greyhead,

Thanks I will be waiting for.

Boris
GreyHead 25 Apr, 2011
Hi Boris,

I've written an 'alternative' Email action for CFv4 that will allow you to attach exisiting files as well as uploaded files. Please see this post

Bob
This topic is locked and no more replies can be posted.