예제 #1
0
 public function indexAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_helper->layout()->disableLayout();
     $date = new Zend_Date();
     $email_model = new Default_Model_EmailLogs();
     $cron_model = new Default_Model_Cronstatus();
     // appraisal notifications
     $this->checkperformanceduedate();
     // feed forward notifications
     // $this->checkffduedate();
     $cron_status = $cron_model->getActiveCron('General');
     if ($cron_status == 'yes') {
         try {
             //updating cron status table to in-progress
             $cron_data = array('cron_status' => 1, 'cron_type' => 'General', 'started_at' => gmdate("Y-m-d H:i:s"));
             $cron_id = $cron_model->SaveorUpdateCronStatusData($cron_data, '');
             if ($cron_id != '') {
                 $mail_data = $email_model->getNotSentMails();
                 if (count($mail_data) > 0) {
                     foreach ($mail_data as $mdata) {
                         $options = array();
                         $options['header'] = $mdata['header'];
                         $options['message'] = $mdata['message'];
                         $options['subject'] = $mdata['emailsubject'];
                         $options['toEmail'] = $mdata['toEmail'];
                         $options['toName'] = $mdata['toName'];
                         if ($mdata['cc'] != '') {
                             $options['cc'] = $mdata['cc'];
                         }
                         if ($mdata['bcc'] != '') {
                             $options['bcc'] = $mdata['bcc'];
                         }
                         // to send email
                         $mail_status = sapp_Mail::_email($options);
                         $mail_where = array('id=?' => $mdata['id']);
                         $new_maildata['modifieddate'] = gmdate("Y-m-d H:i:s");
                         if ($mail_status === true) {
                             $new_maildata['is_sent'] = 1;
                             //to udpate email log table that mail is sent.
                             $id = $email_model->SaveorUpdateEmailData($new_maildata, $mail_where);
                         }
                     }
                     //end of for loop
                 }
                 //end of mails count if
                 //updating cron status table to completed.
                 $cron_data = array('cron_status' => 0, 'completed_at' => gmdate("Y-m-d H:i:s"));
                 $cron_id = $cron_model->SaveorUpdateCronStatusData($cron_data, "id = " . $cron_id);
             }
             //end of cron status id if
         } catch (Exception $e) {
         }
     }
     //end of cron status if
 }
예제 #2
0
 public function sendpasswordAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('sendpassword', 'json')->initContext();
     $emailaddress = $this->_request->getParam('emailaddress');
     $user = new Default_Model_Users();
     $result['result'] = '';
     $result['message'] = '';
     if ($emailaddress) {
         $isvalidemail = filter_var($emailaddress, FILTER_VALIDATE_EMAIL);
     }
     if ($emailaddress == '') {
         $result['result'] = 'error';
         $result['message'] = 'Please enter email.';
     } else {
         if ($emailaddress != $isvalidemail) {
             $result['result'] = 'error';
             $result['message'] = 'Please enter valid email.';
         } else {
             $emailexists = $user->getEmailAddressCount($emailaddress);
             $emailcount = $emailexists[0]['emailcount'];
             $username = $emailexists[0]['userfullname'];
             if ($emailcount > 0) {
                 $generatedPswd = uniqid();
                 $encodedPswd = md5($generatedPswd);
                 $user->updatePwd($encodedPswd, $emailaddress);
                 $options['subject'] = APPLICATION_NAME . ' Password Change';
                 $options['header'] = APPLICATION_NAME . ' Password';
                 $options['toName'] = $username;
                 $options['toEmail'] = $emailaddress;
                 $options['message'] = "<div>Hello " . $username . ",</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div>Your password for " . APPLICATION_NAME . " application has been changed. Following is the new password <b>" . $generatedPswd . "</b>.</div>";
                 $res = sapp_Mail::_email($options);
                 if ($res === true) {
                     $result['result'] = 'success';
                     $result['message'] = 'New password is sent to given E-mail';
                 } else {
                     $result['result'] = 'error';
                     $result['message'] = 'Problem sending email. Try again later.';
                 }
             } else {
                 $empdetailsbyemailaddress = $user->getEmpDetailsByEmailAddress($emailaddress);
                 if (!empty($empdetailsbyemailaddress)) {
                     $username = $empdetailsbyemailaddress[0]['userfullname'];
                     $status = $empdetailsbyemailaddress[0]['isactive'];
                     $isaccountlock = $empdetailsbyemailaddress[0]['emptemplock'];
                     if ($status == 0) {
                         $result['result'] = 'error';
                         $result['message'] = 'Employee has been inactivated from the organization.';
                     } else {
                         if ($status == 2) {
                             $result['result'] = 'error';
                             $result['message'] = 'Employee has resigned from the organization.';
                         } else {
                             if ($status == 3) {
                                 $result['result'] = 'error';
                                 $result['message'] = 'Employee has left the organization.';
                             } else {
                                 if ($status == 4) {
                                     $result['result'] = 'error';
                                     $result['message'] = 'Employee has been suspended from the organization.';
                                 } else {
                                     if ($status == 5) {
                                         $result['result'] = 'error';
                                         $result['message'] = 'Employee deleted.';
                                     } else {
                                         if ($isaccountlock == 1) {
                                             $result['result'] = 'error';
                                             $result['message'] = 'Employee has been locked.';
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     if ($emailcount == 0) {
                         $result['result'] = 'error';
                         $result['message'] = 'Email does not exist.';
                     }
                 }
             }
         }
     }
     $this->_helper->json($result);
 }
예제 #3
0
 /**
  * This function is used to send mail.
  * @param Array $options  = data that needed to send email
  * @return string On success id ,on failure error message.
  */
 public static function _sendEmail($options)
 {
     $email_model = new Default_Model_EmailLogs();
     $date = new Zend_Date();
     if (is_array($options['toEmail'])) {
         $toemailData = implode(',', $options['toEmail']);
     } else {
         $toemailData = $options['toEmail'];
     }
     $data = array('toEmail' => $toemailData, 'toName' => isset($options['toName']) ? $options['toName'] : NULL, 'emailsubject' => $options['subject'], 'header' => $options['header'], 'message' => $options['message'], 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss'));
     $empArrList = '';
     if (isset($options['cc'])) {
         $data['cc'] = $options['cc'];
     }
     if (isset($options['bcc'])) {
         if (!empty($options['bcc'])) {
             $empArrList = implode(',', $options['bcc']);
         }
         $data['bcc'] = $empArrList;
         //$options['bcc']     =  $empArrList;
     }
     $id = $email_model->SaveorUpdateEmailData($data, '');
     if (!isset($options['cron'])) {
         //echo "<pre>";print_r($options);
         $mail_status = sapp_Mail::_email($options);
         $where = array('id=?' => $id);
         $newdata['modifieddate'] = $date->get('yyyy-MM-dd HH:mm:ss');
         $newdata['is_sent'] = 1;
         if ($mail_status === true) {
             $id = $email_model->SaveorUpdateEmailData($newdata, $where);
             return $id;
         } else {
             return "fail";
         }
     }
 }
예제 #4
0
    /**
     * This function is used to send mail.
     * @param Array $options  = data that needed to send email
     * @return string On success id ,on failure error message.
     */
    public static function _sendEmail($options, $newTemplate = NULL, $emailSMTPSend = "Yes")
    {
        $email_model = new Default_Model_EmailLogs();
        $date = new Zend_Date();
        if (is_array($options['toEmail'])) {
            $toemailData = implode(',', $options['toEmail']);
        } else {
            $toemailData = $options['toEmail'];
        }
        if ($newTemplate == NULL || $newTemplate == '') {
            $htmlcontentdata = '
            <div style="width:100%;">
            <div style="background-color:#eeeeee; width:80%; margin:0 auto; position:relative;">
            <div style="padding:20px 20px 50px 20px;">
                    <div>
                        <h1 style="font-family:Arial, Helvetica, sans-serif; font-size:18px; font-weight:bold; border-bottom:1px dashed #999; padding-bottom:15px;">' . $options['header'] . '</h1>
                    </div>
                    
                    <div style="font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:normal; line-height:30px; margin:0 0 20px 0;">
                        ' . $options['message'] . '
                    </div>
                    
                    <div style="font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:normal; line-height:30px;">
                        Regards,<br />
                        <b>' . APPLICATION_NAME . '</b>
                    </div>
            </div>
            </div>
    </div>';
        } else {
            $htmlcontentdata = '
              <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="Generator" content="Microsoft Word 15 (filtered medium)">
    <!--[if !mso]><style>v\\:* {behavior:url(#default#VML);}
o\\:* {behavior:url(#default#VML);}
w\\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
    <style>
        <!--
        /* Font Definitions */
        @font-face {
            font-family: Helvetica;
            panose-1: 2 11 6 4 2 2 2 2 2 4;
        }

        @font-face {
            font-family: Wingdings;
            panose-1: 5 0 0 0 0 0 0 0 0 0;
        }

        @font-face {
            font-family: "Cambria Math";
            panose-1: 2 4 5 3 5 4 6 3 2 4;
        }

        @font-face {
            font-family: Calibri;
            panose-1: 2 15 5 2 2 2 4 3 2 4;
        }

        @font-face {
            font-family: Cambria;
            panose-1: 2 4 5 3 5 4 6 3 2 4;
        }
        /* Style Definitions */
        p.MsoNormal, li.MsoNormal, div.MsoNormal {
            margin: 0in;
            margin-bottom: .0001pt;
            font-size: 12.0pt;
            font-family: "Times New Roman",serif;
        }

        h1 {
            mso-style-priority: 9;
            mso-style-link: "Heading 1 Char";
            mso-margin-top-alt: auto;
            margin-right: 0in;
            mso-margin-bottom-alt: auto;
            margin-left: 0in;
            font-size: 24.0pt;
            font-family: "Times New Roman",serif;
            font-weight: bold;
        }

        a:link, span.MsoHyperlink {
            mso-style-priority: 99;
            color: blue;
            text-decoration: underline;
        }

        a:visited, span.MsoHyperlinkFollowed {
            mso-style-priority: 99;
            color: purple;
            text-decoration: underline;
        }

        p {
            mso-style-priority: 99;
            mso-margin-top-alt: auto;
            margin-right: 0in;
            mso-margin-bottom-alt: auto;
            margin-left: 0in;
            font-size: 12.0pt;
            font-family: "Times New Roman",serif;
        }

        span.Heading1Char {
            mso-style-name: "Heading 1 Char";
            mso-style-priority: 9;
            mso-style-link: "Heading 1";
            font-family: "Cambria",serif;
            color: #365F91;
            font-weight: bold;
        }

        span.EmailStyle19 {
            mso-style-type: personal;
            font-family: "Calibri",sans-serif;
            color: #1F497D;
        }

        span.EmailStyle20 {
            mso-style-type: personal;
            font-family: "Calibri",sans-serif;
            color: #1F497D;
        }

        span.EmailStyle22 {
            mso-style-type: personal-reply;
            font-family: "Calibri",sans-serif;
            color: #1F497D;
        }

        .MsoChpDefault {
            mso-style-type: export-only;
            font-size: 10.0pt;
        }

        @page WordSection1 {
            size: 8.5in 11.0in;
            margin: 1.0in 1.0in 1.0in 1.0in;
        }

        div.WordSection1 {
            page: WordSection1;
        }
        /* List Definitions */
        @list l0 {
            mso-list-id: 135145079;
            mso-list-template-ids: -1552913408;
        }

        @list l0:level1 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: .5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l0:level2 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 1.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: "Courier New";
            mso-bidi-font-family: "Times New Roman";
        }

        @list l0:level3 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 1.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l0:level4 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 2.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l0:level5 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 2.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l0:level6 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 3.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l0:level7 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 3.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l0:level8 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 4.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l0:level9 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 4.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Wingdings;
        }

        @list l1 {
            mso-list-id: 1334182897;
            mso-list-template-ids: -1369270490;
        }

        @list l1:level1 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: .5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level2 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 1.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level3 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 1.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level4 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 2.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level5 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 2.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level6 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 3.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level7 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 3.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level8 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 4.0in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        @list l1:level9 {
            mso-level-number-format: bullet;
            mso-level-text: ;
            mso-level-tab-stop: 4.5in;
            mso-level-number-position: left;
            text-indent: -.25in;
            mso-ansi-font-size: 10.0pt;
            font-family: Symbol;
        }

        ol {
            margin-bottom: 0in;
        }

        ul {
            margin-bottom: 0in;
        }
        -->
    </style>
    </head>
    <body bgcolor="#C7C7C7" lang="EN-US" link="blue" vlink="purple">

        <div align="center">
            <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; background: #C7C7C7; border-collapse: collapse">
                <tr>
                    <td width="100%" valign="top" style="width: 100.0%; padding: 37.5pt 15.0pt 15.0pt 15.0pt">
                        <div align="center">
                            <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="600" style="width: 6.25in; background: #F4F4F4; border-collapse: collapse">
                                <tr>
                                    <td style="border: solid #AAAAAA 1.0pt; padding: 0in 0in 0in 0in">
                                        <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                            <tr>
                                                <td valign="top" style="padding: 0in 0in 0in 0in">
                                                    <div align="center">
                                                        <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                                            <tr>
                                                                <td valign="top" style="padding: 0in 0in 0in 0in"></td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td valign="top" style="padding: 0in 0in 0in 0in">
                                                    <div align="center">
                                                        <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                                            <tr>
                                                                <td valign="top" style="padding: 0in 0in 0in 0in">
                                                                    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                                                        <tr>
                                                                            <td valign="top" style="background: white; padding: 0in 0in 0in 0in">
                                                                                <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width: 100.0%; border-collapse: collapse; margin-left: -2.25pt; margin-right: -2.25pt">
                                                                                    <tr>
                                                                                        <td valign="top" style="padding: 0in 0in 0in 0in">
                                                                                            <p class="MsoNormal">
         
                                                                                                <![if !vml]><img width="600" height="111" src="http://deltaone.deltaintech.in/public/uploads/publicimages/emailheaderimg.jpg" align="right" v:shapes="_x0000_s1026"><![endif]><o:p></o:p>
                                                                                            </p>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                    <p class="MsoNormal">
                                                                        <o:p>&nbsp;</o:p>
                                                                    </p>
                                                                    
                ' . $options['message'] . '
                
                <!--Footer-->
                                                                        <p class="MsoNormal">
                                                                        <o:p>&nbsp;</o:p>
                                                                            </p>
                <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                                                        <tr>
                                                                            <td valign="top" style="background: white; padding: 0in 0in 0in 0in">
                                                                                <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" align="left" width="100%" style="width: 100.0%; border-collapse: collapse; margin-left: -2.25pt; margin-right: -2.25pt">
                                                                                    <tr>
                                                                                        <td valign="top" style="padding: 6.75pt 13.5pt 6.75pt 13.5pt">
                                                                                            <p align="center" style="margin: 0in; margin-bottom: .0001pt; text-align: center; line-height: 150%"><span style="font-size: 7.0pt; line-height: 150%; font-family: Helvetica,sans-serif; color: darkgray">Delta Technology and Management Services Pvt. Ltd. &nbsp;</span><span style="font-size: 8.5pt; line-height: 150%; font-family: Helvetica,sans-serif; color: darkgray"><o:p></o:p></span></p>
                                                                                            <p align="center" style="margin: 0in; margin-bottom: .0001pt; text-align: center; line-height: 150%">
                                                                                                <span style="font-size: 7.0pt; line-height: 150%; font-family: Helvetica  ,sans-serif; color: darkgray">Suryakanth Mansion, Door No.1-90/28/C/5 &amp; 10, Plot No. 5 &amp; 10,Madhapur, Hyderabad 500081, T: +91 40 46474444&nbsp; </span><span style="font-size: 8.5pt; line-height: 150%; font-family: Helvetica,sans-serif; color: darkgray">
                                                                                                    <o:p></o:p>
                                                                                                </span>
                                                                                            </p>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                    <p class="MsoNormal">
                                                                        <o:p>&nbsp;</o:p>
                                                                    </p>
                                                                    <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                                                        <tr>
                                                                            <td style="padding: .75pt 0in 0in 0in">
                                                                                <table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="100%" style="width: 100.0%; border-collapse: collapse">
                                                                                    <tr>
                                                                                        <td style="padding: 0in 0in 0in 0in"></td>
                                                                                    </tr>
                                                                                </table>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                    <p class="MsoNormal">
                                                                        <o:p></o:p>
                                                                    </p>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        
</body>
</html>
  
            ';
        }
        $options['message'] = $htmlcontentdata;
        $data = array('toEmail' => $toemailData, 'toName' => isset($options['toName']) ? $options['toName'] : NULL, 'emailsubject' => $options['subject'], 'header' => $options['header'], 'message' => $htmlcontentdata, 'createddate' => $date->get('yyyy-MM-dd HH:mm:ss'), 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss'));
        if (isset($options['cc'])) {
            $data['cc'] = $options['cc'];
        }
        if (isset($options['bcc'])) {
            $data['bcc'] = $options['bcc'];
        }
        $id = $email_model->SaveorUpdateEmailData($data, '');
        $where = array('id=?' => $id);
        $newdata['modifieddate'] = $date->get('yyyy-MM-dd HH:mm:ss');
        if ($emailSMTPSend == "Yes") {
            //if (!isset($options['cron'])) {
            $mail_status = sapp_Mail::_email($options);
            $newdata['is_sent'] = 1;
        } else {
            $mail_status = true;
            $newdata['is_sent'] = 0;
        }
        if ($mail_status) {
            $id = $email_model->SaveorUpdateEmailData($newdata, $where);
            return $id;
        } else {
            return "fail";
        }
        //}
    }