Email Templates
2 posts by 2 authors in: Forums > CMS Builder
Last Post: May 15, 2014 (RSS)
By KCMedia - May 4, 2014
Hi all
i have 4 forms on a website that are being sent though the cmsb admin using the email templates to send the data to the clients these are working perfect but i need to have it so that when someone submits a form to the website on some of the forms that it auto replies to them with the details of the submission.
I can have the TO field in the templates to be email@domain.com, #email# which is the email of the person that submits for the form and this works but is there a way to have a CC field in the email templates section?
i tried adding a new text field but that dosnt work.
Craig
KC Media Solutions
www.kcmedia.biz
By gregThomas - May 15, 2014
Hi Craig,
It's not possible to add a CC via a field in the e-mail templates section, but you can add a CC to a e-mail template before it's sent in the sendMessage function, here is an example of how this can be done:
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/greg/www/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
//Create the appropriate headers from a e-mail template
$emailHeaders = emailTemplate_loadFromDB(array(
'template_id' => 'THIS-IS-A-TEST',
'placeholders' => array(
'user.num' => "enter value",
'user.email' => "enter value",
'resetUrl' => "enter value",
//'your_placeholder' => "your value", // add new placeholders here
)
));
//Add CC to e-mail headers.
$emailHeaders['headers']['CC'] = 'test@example.com';
//Send the message
$mailErrors = sendMessage($emailHeaders);
if ($mailErrors) { die("Mail Error: $mailErrors"); }
So this should add a CC to the e-mail address set in $emailHeaders['headers']['CC'], which is test@example in this example.
Thanks!
Greg
PHP Programmer - interactivetools.com