Beispiel #1
0
    /**
     * 
     * @param type $options
     * @return string
     */
    public static function _checkMail($options = array())
    {
        $options['fromEmail'] = DONOTREPLYEMAIL;
        $options['fromName'] = SUPERADMIN_EMAIL;
        $orglogo = '';
        $imgsource = '';
        $Orgmodel = new Default_Model_Organisationinfo();
        $orglogoArr = $Orgmodel->getOrgLogo();
        if (!empty($orglogoArr)) {
            $orglogo = $orglogoArr['org_image'];
        }
        if ($orglogo != '') {
            $imgsource = DOMAIN . 'public/uploads/organisation/' . $orglogo;
        } else {
            $imgsource = MEDIA_PATH . 'images/mail_pngs/hrms_logo.png';
        }
        $header = "";
        $footer = "";
        $config = array('tls' => $options['tls'], 'auth' => $options['auth'], 'username' => $options['username'], 'password' => $options['password'], 'port' => $options['port']);
        $smtpServer = $options['server_name'];
        //end of sapplica mail configuration
        $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
        Zend_Mail::setDefaultTransport($transport);
        $mail = new Zend_Mail('UTF-8');
        $htmlcontentdata = '
				<div style="width:100%;">
			            <div style="background-color:#eeeeee; width:80%; margin:0 auto; position:relative;">
			            <div><img src="' . $imgsource . '" onError="' . MEDIA_PATH . 'images/mail_pngs/hrms_logo.png" height="62" width="319" /></div>
			            <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>';
        $mail->setSubject($options['subject']);
        $mail->setFrom($options['fromEmail'], $options['fromName']);
        $mail->addTo($options['toEmail'], $options['toName']);
        $mail->setBodyHtml($htmlcontentdata);
        if (array_key_exists('bcc', $options)) {
            $mail->addBcc($options['bcc']);
        }
        if (array_key_exists('cc', $options)) {
            $mail->addCc($options['cc']);
        }
        try {
            if (!empty($options['toEmail'])) {
                $a = @$mail->send();
                return 'success';
            }
        } catch (Exception $ex) {
            $a = "error";
        }
        return $a;
    }
Beispiel #2
0
 public static function _checkMail($options = array())
 {
     $options['fromEmail'] = !empty($options['fromEmail']) ? $options['fromEmail'] : SUPERADMIN_EMAIL;
     $options['fromName'] = !empty($options['fromName']) ? $options['fromName'] : DONOTREPLYNAME;
     $orglogo = '';
     $imgsource = '';
     $a = '';
     $Orgmodel = new Default_Model_Organisationinfo();
     $orglogoArr = $Orgmodel->getOrgLogo();
     if (!empty($orglogoArr)) {
         $orglogo = $orglogoArr['org_image'];
     }
     if (!empty($orglogo)) {
         $imgsource = DOMAIN . 'public/uploads/organisation/' . $orglogo;
     } else {
         $imgsource = MEDIA_PATH . 'images/mail_pngs/hrms_logo.png';
     }
     $header = "";
     $footer = "";
     if (!empty($options['server_name']) && !empty($options['auth']) && !empty($options['port'])) {
         if ($options['auth'] == 'true' && !empty($options['username']) && !empty($options['password'])) {
             $config = array('auth' => $options['auth'], 'username' => $options['username'], 'password' => $options['password'], 'port' => $options['port']);
         } else {
             if ($options['auth'] == 'false') {
                 $config = array('auth' => $options['auth'], 'port' => $options['port']);
             }
         }
         if (!empty($options['tls'])) {
             $config['tls'] = $options['tls'];
         }
         $smtpServer = $options['server_name'];
     }
     //end of sapplica mail configuration
     return self::send_php_mail($config, $smtpServer, $imgsource, $options);
 }