In this article we will describe how to store the submission in a file and send it through the email.
The following script will work only with the latest version of RSForm! Pro. Here's what you need to do:
In the PHP Email Scripts area, type this code (either in the "Script called before the User Email is sent." area or the "Script called before the Admin Email is sent.", depending on what you require. The only difference is that you will have to use the $adminEmail variable or the $userEmail variable):
if(isset($_POST['form']['test'])){
$fp = fopen(JPATH_SITE.'/components/com_rsform/uploads/test.txt', 'w');
$str = '';
foreach($_POST['form'] as $component=>$value){
if(is_array($value)) $value = implode(',',$value);
$str.=$component.'='.$value."\r\n";
}
fwrite($fp, $str);
fclose($fp);
$adminEmail['files'][] = JPATH_SITE.'/components/com_rsform/uploads/test.txt';
}Make sure that /components/com_rsform/uploads is writable.
Go to the Admin Emails, and customize it similar to this:
From: support@yourwebsite.com
To: youradminthatreceivesthefile@yourwebsite.com
Note:
You have to fill in the rest of the email fields (leave none empty).
Here's how it will work:
1. The user submits
2. The system writes test.txt in /components/com_rsform/uploads/test.txt
3. The system attaches this file to the mail sent to the admin.





