Yes, you can.
First, in order to catch the page location, you need to create a new element of type HIDDEN INPUT with settings as follows:
Type: Hidden Input
Label: Page Title
Name: PageTitle (exactly as shown!)
Value: Enter the following code:
<?php return htmlentities( JFactory::getDocument()->getTitle(), ENT_QUOTES, 'UTF-8' ); ?>
Now, to make this work, the automatic Email has to be replaced with an END SUBMIT piece that will generate and send the Email out.
If your user's first and last name will be captured in a single textfield element, then follow the first set of instructions below. If your user's first and last names are captured separately, then scroll down to the next section.
IF YOUR NAME FIELD IS CONTAINED WITHIN ONE FIELD
1. In your form's properties, make sure that the "Mail Notification" checkbox is UNCHECKED.
2. Copy the code below.
$this->execPieceByName('ff_InitLib');
$from = ff_getSubmit('email');
$fromname = ff_getSubmit('Name');
$subject = ff_getSubmit('PageTitle');
$recipient = 'your@email.com'; // Change to Your Admin Email Address
$body = '';
foreach ($this->maildata as $data) {
$body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl();
}
$this->sendMail($from, $fromname, $recipient, $subject, $body); // This line actually emails the form.
3. Make Changes to the Code as Needed - IMPORTANT!
The above code assumes that the "Name" element on the form is actually called name in the NAME field underneath the LABEL. Similarly, it also assumes that the "Email" element on the form is actually called email in the NAME field underneath the LABEL. Also, remember to change your@email.com in the code to your actual admin email address.
4. Once you have edited and copied the code, go to Form Properties > Advanced Tab, and click on the "More Options" link.
5. Go to the SUBMIT PIECES tab, to the END SUBMIT section, and click on the CUSTOM radio button. That will open a text area into which you should paste the code that you just edited and copied.
6. Click on the SAVE icon at the bottom of that screen to save the code you just added.
7. Once back at the base page of your form, click on the SAVE icon in the upper right-hand corner of the screen to save the form itself.
8. Test your form to see if it works.
IF YOUR NAME FIELD IS SPLIT INTO FIRST NAME AND LAST NAME
If you have your name field separated into two fields - first and last name - then the code will need to be adjusted slightly. In that case, use the following:
1. In your form's properties, make sure that the "Mail Notification" checkbox is UNCHECKED.
2. Copy the code below.
$this->execPieceByName('ff_InitLib');
$from = ff_getSubmit('email');
$fromname = ff_getSubmit('fname').' '.ff_getSubmit('lname');
$subject = ff_getSubmit('PageTitle');
$recipient = 'your@email.com'; // Change to Your Admin Email Address
$body = '';
foreach ($this->maildata as $data) {
$body .= $data[_FF_DATA_TITLE].": ".$data[_FF_DATA_VALUE].nl();
}
$this->sendMail($from, $fromname, $recipient, $subject, $body); // This line actually emails the form.
3. Make Changes to the Code as Needed - IMPORTANT!
The above code assumes that the "First Name" element on the form is actually called fname in the NAME field underneath the LABEL. Similarly, it also assumes that the "Last Name" element on the form is actually called lname in the NAME field underneath the LABEL, and that the "Email" element on the form is actually called email in the NAME field underneath the LABEL. Also, remember to change your@email.com in the code to your actual admin email address.
4. Once you have edited and copied the code, go to Form Properties > Advanced Tab, and click on the "More Options" link.
5. Go to the SUBMIT PIECES tab, to the END SUBMIT section, and click on the CUSTOM radio button. That will open a text area into which you should paste the code that you just edited and copied.
6. Click on the SAVE icon at the bottom of that screen to save the code you just added.
7. Once back at the base page of your form, click on the SAVE icon in the upper right-hand corner of the screen to save the form itself.
8. Test your form to see if it works.
I like this, but I want to send my form to multiple Admin emails. Can I do that?
Yes, you can. First, delete this line of code:
$recipient = 'your@email.com';
// Change to Your Admin Email Address
Then replace the last line in the code:
$this->sendMail($from,
$fromname, $recipient, $subject, $body); // This line actually emails
the form.
with:
$this->sendMail($from, $fromname,
"yourAdmin1@email.com", $subject, $body); // This line actually emails
the form.
$this->sendMail($from, $fromname,
"yourAdmin2@email.com", $subject, $body); // This line actually emails
the form.
$this->sendMail($from, $fromname,
"yourAdmin3@email.com", $subject, $body); // This line actually emails
the form.
(This can be added as many times as needed -- one for
each Email address you need to send out.)
I'd like to send a copy to the user (mailback), too. Can I do that?
Sure. Just add this line at the end:
$this->sendMail($from, $fromname, ff_getSubmit('userEmail'), $subject, $body); // This line actually emails the form.
* Remember to change 'userEmail' in the code above to the NAME of the textfield element that is collecting the user's Email address.
![]() |
Was this helpful?
Yes
No
Print
Pdf
|

