$data_email_sender = new FM_FormDataSender(sfm_readfile("./templ/orderform_email_subj.txt"),sfm_readfile("./templ/orderform_email_body.txt"),"%Email%");
$data_email_sender->AddToAddr("recipient one<person@home.com>");
$data_email_sender->AddToAddr("recipient two<person@home.com>");
//-----Added Sample Code Start---------
if(isset($_POST['sfm_form_submitted']))
{
if($_POST['store'] == 'Queen')
{
$data_email_sender->AddToAddr("recipient three<person@home.com>");
}
elseif($_POST['store'] == 'Disera')
{
$data_email_sender->AddToAddr("recipient four<person@home.com>");
}
elseif($_POST['store'] == 'Wilson')
{
$data_email_sender->AddToAddr("recipient five<person@home.com>");
}
}
//-----Added Sample Code End ---------
From the orderform-lib.php
////////FormDataSender/////////////
class FM_FormDataSender extends FM_ComposedMailSender
{
var $mail_subject;
var $mail_template;
var $dest_list;
var $mail_from;
var $file_upload;
var $attach_files;
function FM_FormDataSender($subj="",$templ="",$from="")
{
$this->mail_subject=$subj;
$this->mail_template=$templ;
$this->dest_list=array();
$this->mail_from=$from;
$this->file_upload=NULL;
$this->attach_files = true;
}
function SetFileUploader(&$fileUploader)
{
$this->file_upload = &$fileUploader;
}
function AddToAddr($toaddr)
{
array_push($this->dest_list,$toaddr);
}
function SetAttachFiles($attach_files)
{
$this->attach_files = $attach_files;
}
function SendFormData()
{
$this->InitMailer();
$this->ComposeMessage($this->mail_subject,
$this->mail_template);
if($this->attach_files && NULL != $this->file_upload )
{
$this->file_upload->AttachFiles($this->mailer);
}
$from_merge = new FM_PageMerger();
$from_merge->Merge($this->mail_from,$this->formvars);
$this->mail_from = $from_merge->getMessageBody();
foreach($this->dest_list as $to_address)
{
$this->logger->LogInfo("sending form data to: $to_address");
$this->SendMail($this->mail_from,
$to_address);
}
}
function Process(&$continue)
{
if(strlen($this->mail_template)<=0||
count($this->dest_list)<=0)
{
return false;
}
$continue = true;
$this->SendFormData();
return true;
}
}