Form Generator - Email Form Results

Hi! 

I'm just following up on an old post of mine regarding emailing the content of a form to a specific email address. I know someone mentioned to modify the plugin by calling the sendMessage() function (in /cmsb/lib/common.php) when the record is successfully created. I'm just a little puzzled on what exactly to modify and where inside common.php.

Thanks!

By daniel - February 12, 2019

Hi Shawn,

I may have been a little unclear in my previous post; I was pointing out common.php as the place where you can find the sendMessage() function and some examples of its usage. Instead, I'd recommend adding the sendMessage() function to the form page so that it runs after the form is successfully submitted (probably somewhere after fg_util_insertOrUpdateRecord() gets called).

Here's an example of a basic sendMessage() call:

$mailErrors  = sendMessage(array(
  'from'    => 'from@address.com',
  'to'      => 'to@address.com',
  'subject' => "Subject line",
  'text'    => $messageText,
));
if ($mailErrors) { trigger_error($mailErrors, E_USER_ERROR); }

You will need to update the from/to/subject, plus create a $messageText variable containing the email body, including any form submission values you want.

Let me know if that helps!

Thanks,

Daniel
Technical Lead
interactivetools.com