global $mosConfig_mailfrom, $mosConfig_fromname, $my;

$this->execPieceByName('ff_InitLib');

// Send profile to Client

$from = ff_getSubmit('fabianokrul@gmail.com');  //fldReplyEmmail is a field i defined when building a form for the person submitting the form to 
enter their email address in.  I simply pull this form value.

$fromname = ff_getSubmit('FirstName').' '.ff_getSubmit('Surname');  // FirstName and Surname are two fields of my form that I simply pull and concatenate, BUT this 
could be of course anything you want it to be.

$subject = ff_getSubmit('fldSubject');  // flSubject is a hidden field in my form which I have set its value to the subject I want to 
appear as my email subject.  I simply pull it.

$recipient = 'fabianokrul@gmail.com';  // Here I hardcoded the email where I want the form to be submitted too.

// Create the Body format for use in e-mail.  I pull the below bit of code directly from the facile 
form processor php file,
// with the addition to ignore hidden fields when building the body of the email.  I did this 
because the Hidden fields
// in my form are control fields like fldSubject which I dont want to appear in the submitted form 
data.
foreach ($this->maildata as $data) {
     if ($data[_FF_DATA_TYPE] != 'Hidden Input') {
          $body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl();
     }
}


$this->sendMail($from, $fromname, $recipient, $subject, $body);  // This line acutally emails off the form.
