User Tools

Site Tools


Upgrade to Form-to-Email Pro

TTG galleries including mail functionality – the Contact page in TTG CE3 Pages, and feedback submission in TTG CE3 Client Response Gallery – utilize the free PHP mail script from The Form-to-Email script is powerful, secure and well-supported, hence our decision to include it in the CE3 framework.

The Form-to-Email script is available in two versions. The free version included in TTG web engines is the lesser of the two, but adequate for most needs. For $29, a Pro version is available with many additional features. For information and a list of features specific to Form-to-Email Pro, please visit

Should you wish to upgrade your web engines – TTG CE3 Pages and TTG CE3 Client Response Gallery – to use Form-to-Email Pro, these are the steps you should take:

1. Rename the Pro version file.

In CE3 web engines, the file name for the Form-to-Email script should be form-to-email.php. Renaming the Pro version file ensures that we need not take on the larger task of editing the source code of our galleries.

2. Edit the Pro version form-to-email.php file

CE3 engines allow several important parameters to be set from within Lightroom, as well as using our custom “Thank You” page to follow up on contact form submission. To keep these features in the Pro version script, you will need to make some minor changes to the script. It's really easy, so don't stress.

The top of the Form-to-Email Pro script looks like this:


error_reporting(E_ALL ^ E_NOTICE);


Thank you for purchasing FormToEmail-Pro by

Update the script to look like this; you can copy-and-paste from this page:


if (!defined('RESOURCES_URL'))
	define('RESOURCES_URL', './resources');

include RESOURCES_URL.'/php/set-email.php';

error_reporting(E_ALL ^ E_NOTICE);


Thank you for purchasing FormToEmail-Pro by

Next, locate and “comment out” the following lines of code by fronting them with //:

$my_email = "delete these words and put the email address only in here between the quotes";
$from_email = "";
$continue = "/";

These lines should become:

//$my_email = "delete these words and put the email address only in here between the quotes";
//$from_email = "";
//$continue = "/";

Note, the only change we have made is to insert // before each line.

Now, locate this line:

$auto_redirect = 0;

And change to:

$auto_redirect = 1;

Next setting below that, find:

$redirect_url = "";

And change to:

$redirect_url = "index.php?page=thankyou";

Locate these lines:

// Display any errors and exit if errors exist.

if(count($errors) && $show_errors_on_form_page == 0){foreach($errors as $value){print stripslashes(htmlspecialchars($value)) . "<br>";} exit;}

Change to:

// Display any errors and exit if errors exist.

if(count($errors) && $show_errors_on_form_page == 0){foreach($errors as $value){print stripslashes(htmlspecialchars($value)) . "<br />";} 
print '<a href="'.$continue.'">Return to Form</a>';
// No need to remember the form values
if (isset($unique_id)) {
} else {

Save the file.

3. Customize your Form-to-Email Setup

The above changes complete, run through the Form-to-Email Pro script and configure whatever options you'd like to use. Options are all documented within the script, so it's pretty easy to enable the Pro version features you've paid for.

4. Keep a backup

Once you've completed the above modifications and configured your Pro-version features, you should backup the script in a safe place. Anytime you download an update for either TTG CE3 Pages or TTG CE3 Client Response Gallery, you will want to update the new engine version with your Form-to-Email Pro script (see step 5 below), so keep it safe and keep it handy.

5. Copy your modified form-to-email.php file into the web engine

You will need to open the .lrwebengine package installed to your Web Galleries folder. On Windows, you should be able to double-click the .lrwebengine package to open it as a folder; on Mac, CTRL-click the .lrwebengine package and select “Show Package Contents” from the menu.

You will find the Form-to-Email script at:


Replace the existing version of the script with your modified Pro version. The Pro version file name should be the same as the existing version, so you will get an overwrite notification; overwrite the existing file.

6. Test it

Very, very important: test your script before deploying your changes in a production environment. Run a test gallery, attempt to use the form and verify that all is in working order before you put it out there for clients to use.


After upgrading to Form-to-Email Pro, you may receive this error when submitting the contact form:

You have entered an invalid string (http://) in the “Gallery_URL” field

If so, there are two possible fixes.

#1 Fix: Unblock 'http://' and maybe 'https://'

This fix is easiest, but maybe not the best depending on your situation. Locate this option:

$blocked_words = array('http://','https://','viagra');

Remove 'http://', from the array, so that you're left with this:

$blocked_words = array('https://','viagra');

You may or may not also wish to remove 'https://', from the array.

Having these blocked prevents users from submitting the form if any field contains a web address. If you are providing your users a “Website” field into which they will be expected to provide a web address, then you will want to unblock these items anyway.

However, this may also make your contact form more vulnerable to spam. So you will need to decide how to handle this situation, and whether to allow web addresses in your form or not.

The more secure method would be to leave the http:// block in place, but to exempt the hidden Gallery_URL field that we use to determine where our message is being sent from. To to this, locate this block of code:

global $set;
global $blocked_words;
global $return_value;
global $return_key;


foreach($blocked_words as $value){if(stristr($element_value,$value)){$set = 1; $return_value = $value; $return_key = $inkey; break;}}

In the above block, change the line:



if(!is_array($element_value || 'Gallery_URL'))
upgrade_to_form-to-email_pro.txt · Last modified: 2013/05/03 07:07 by admin