function TriggerDocumentEmail($lead_id)
{
    $where = 'lead_id =' . $lead_id;
    $params = array('where' => $where);
    $list = TemplateData::getDocumentsList($params);
    if (count($list)) {
        $data = RGFormsModel::get_form($list[0]["form_id"]);
        $to = $list[0]['email'];
        $subject = "ORDER NO: " . $list[0]['file_id'];
        $message = "";
        $message .= "<p>Thank you for your order.  The documents are now attached.<br/></p>";
        //$message .= "<p>Please click on the link  ".$list[0]['file_url']."  to access the documents.</p><br><br>";
        $message .= "<p>Please click on the link  <a href='" . site_url() . "/download.php?q=" . encrypt_doc_url($list[0]['file_url']) . "'</a>  to access the documents.</p><br><br>";
        $message .= "<table style='font-size: 10pt; color: navy;'>\n                        <tr><td>The SMSF Academy</td></tr>\n                        <tr><td>Suite 2, Level 5, 350 Collins Street</td></tr>\n                        <tr><td>MELBOURNE  VIC 3000</td></tr>\n                        <tr><td>thesmsfacademy.com.au</td></tr>\n                        \n                    </table>";
        $message .= "<p style='font-size: 8pt; color: rgb(0, 0, 102);'>Disclaimer:\n                        This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail from your system. Any unauthorised copying, disclosure, dissemination or distribution of the material in this e-mail is strictly forbidden.  The sender and their employer, do not guarantee the integrity of any e-mails or attached files. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any such problems in the contents of this message which arise as a result of e-mail transmission.\n         </p>";
        $message .= "<p><span style='font-size: 9pt; font-family: Webdings; color: rgb(0, 176, 80);'> P </span> <span style=\"font-size: 9pt; font-family: 'Trebuchet MS', sans-serif; color: rgb(0, 176, 80);\">Before you print think about the environment</span></p>";
        $attachments = array($list[0]['file_path']);
        $usermail = SendEmailTo($to, $subject, $message, $attachments, $cc, $bcc);
        $admin_message = $data->title . " document Generated by " . $list[0]['name'] . " (" . $list[0]['email'] . ")";
        $adminmail = SendEmailToAdmins($subject, $admin_message);
        if (!empty($usermail) && $usermail['status'] == 'success') {
            $response = $usermail;
        }
    }
    return $response;
}
            ?>
" class="resume"><?php 
            _e("Resume", "templatemerge");
            ?>
</a>
                                            <a title="<?php 
            _e("Delete", "templatemerge");
            ?>
" href="javascript: if(confirm('<?php 
            _e("Delete this feed? ", "templatemerge");
            ?>
 <?php 
            _e("\\'Cancel\\' to stop, \\'OK\\' to delete.", "templatemerge");
            ?>
')){ DeleteSetting('<?php 
            echo encrypt_doc_url($doc["id"]);
            ?>
');}" class="del"><?php 
            _e("Delete", "templatemerge");
            ?>
</a><br>
                                        </span>
                                    </td>
                                    
                                </tr>
                                <?php 
        }
    } else {
        ?>
                            <tr>
                                <td colspan="7" style="padding:20px;">