setSubject() public method

public setSubject ( $subject )
Ejemplo n.º 1
0
 public static function sendSESFromHtml($html, $to, $subject)
 {
     $tos = array();
     if (!empty($to)) {
         $array = explode(";", $to);
         if (!empty($array) && sizeof($array) > 0) {
             foreach ($array as $mail) {
                 if (!empty($mail)) {
                     array_push($tos, $mail);
                 } else {
                     error_log($mail . " not valid");
                 }
             }
         }
     }
     if (!empty($tos) && sizeof($tos) > 0) {
         $ses = new SimpleEmailService(AWS_SES_API_KEY, AWS_SES_API_SECRET);
         $ses->enableVerifyPeer(false);
         $m = new SimpleEmailServiceMessage();
         $m->setSubjectCharset("UTF-8");
         $m->setMessageCharset("UTF-8");
         foreach ($tos as $mail) {
             $m->addTo($mail);
         }
         $m->setFrom(AWS_SES_API_FROM);
         $m->setSubject($subject);
         $m->setMessageFromString(null, $html);
         return $ses->sendEmail($m);
     } else {
         error_log(LanguageUtils::getText("LANG_UTILS_MAIL_ERROR_EMAIL_EMPTY"));
     }
     return false;
 }
Ejemplo n.º 2
0
 public function send(array $emails, $subject, $body)
 {
     $m = new \SimpleEmailServiceMessage();
     $m->setFrom($this->email);
     $m->addTo($emails);
     $m->setSubject($subject);
     $m->setMessageFromString('', $body);
     return $this->ses->sendEmail($m);
 }
Ejemplo n.º 3
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         $model = new UserRegisterForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'userregister-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['UserRegisterForm'])) {
             $model->attributes = $_POST['UserRegisterForm'];
             // validate user input password
             if ($model->validate()) {
                 $new_user = new User();
                 $new_user->scenario = 'create';
                 //$new_user->username=$model->username;
                 $new_user->username = $new_user->email = $model->email;
                 $new_user->display_name = $model->username;
                 $old_password = $new_user->password = $model->password;
                 //Create hash activation key
                 $new_user->user_activation_key = md5(time() . $new_user->username . USER_SALT);
                 if ($new_user->save()) {
                     //We will send mail for the user
                     $ses = new SimpleEmailService(ConstantDefine::AMAZON_SES_ACCESS_KEY, ConstantDefine::AMAZON_SES_SECRET_KEY);
                     $ses->enableVerifyHost(false);
                     $m = new SimpleEmailServiceMessage();
                     $m->addTo($new_user->email);
                     $m->setFrom(ConstantDefine::AMAZON_SES_EMAIL);
                     $m->setSubject('[' . SITE_NAME . '] Confirm your email at ' . SITE_NAME_URL);
                     $m_content = 'Hi ' . $new_user->display_name . '<br /><br />';
                     $m_content .= 'Welcome to ' . SITE_NAME . '! Please take a second to confirm ' . $new_user->email . ' as your email address by clicking this link: <br /><br />';
                     $link_content = FRONT_SITE_URL . '/user-activation/?key=' . $new_user->user_activation_key . '&user_id=' . $new_user->user_id;
                     $m_content .= '<a href="' . $link_content . '">' . $link_content . '</a><br /><br />';
                     $m_content .= 'Thank you for being with us!<br /><br />';
                     $m_content .= SITE_NAME . ' Team';
                     $m->setMessageFromString($m_content, $m_content);
                     $ses->sendEmail($m);
                     //Redirect to the Dashboard Page
                     $login_form = new UserLoginForm();
                     $login_form->username = $new_user->username;
                     $login_form->password = $old_password;
                     if ($login_form->login()) {
                         Yii::app()->controller->redirect(bu());
                     } else {
                         throw new CHttpException(503, t('Error while setting up your Account. Please try again later'));
                     }
                 }
             }
         }
         $this->render(BlockRenderWidget::setRenderOutput($this), array('model' => $model));
     } else {
         echo '';
     }
 }
Ejemplo n.º 4
0
 public function mail($to, $title, $message, $fullName = "")
 {
     $panelInit = new \DashboardInit();
     $settings = $panelInit->settingsArray;
     $this->title = $settings['siteTitle'];
     $this->settings = json_decode($settings['mailProvider'], true);
     if ($this->settings['mailProvider'] == "" || !isset($this->settings['mailProvider'])) {
         exit;
     }
     if ($this->settings['mailProvider'] == "mail") {
         $header = "From: " . $settings['systemEmail'] . "\r\n";
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-Type: text/html; charset=utf-8\r\n";
         $header .= "X-Priority: 1\r\n";
         mail($to, $title, $message, $header);
     } elseif ($this->settings['mailProvider'] == "phpmailer") {
         $mail = new PHPMailer();
         $mail->From = $settings['systemEmail'];
         $mail->FromName = $settings['siteTitle'];
         $mail->addAddress($to, $fullName);
         $mail->Subject = $title;
         $mail->Body = $message;
         $mail->IsHTML(true);
         $mail->send();
     } elseif ($this->settings['mailProvider'] == "smtp") {
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $mail->SMTPAuth = true;
         $mail->Host = $this->settings['smtpHost'];
         $mail->Port = $this->settings['smtpPort'];
         $mail->Username = $this->settings['smtpUserName'];
         $mail->Password = $this->settings['smtpPassWord'];
         if (isset($this->settings['smtpTLS']) && $this->settings['smtpTLS'] != "") {
             if ($this->settings['smtpTLS'] == "TLS") {
                 $mail->SMTPSecure = 'tls';
             } elseif ($this->settings['smtpTLS'] == "SSL") {
                 $mail->SMTPSecure = 'ssl';
             }
         }
         $mail->SetFrom($settings['systemEmail'], $settings['siteTitle']);
         $mail->Subject = $title;
         $mail->Body = $message;
         $mail->addAddress($to, $fullName);
         $mail->IsHTML(true);
         $mail->Send();
     } elseif ($this->settings['mailProvider'] == "ses") {
         $amazonSES = new SimpleEmailService($this->settings['AmazonSESAccessKey'], $this->settings['AmazonSESSecretKey']);
         $m = new SimpleEmailServiceMessage();
         $m->addTo($to);
         $m->setFrom($this->settings['AmazonSESVerifiedSender']);
         $m->setSubject($title);
         $m->setMessageFromString(strip_tags($message), $message);
         return $amazonSES->sendEmail($m);
     }
 }
Ejemplo n.º 5
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         $model = new UserRecoverPassForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'recoverpassword-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['UserRecoverPassForm'])) {
             $model->attributes = $_POST['UserRecoverPassForm'];
             // validate user input and redirect to the previous page if valid
             if ($model->validate()) {
                 //Find the user with the email
                 $user = User::model()->find('email=:email', array(':email' => $model->email));
                 if ($user) {
                     //Create a new password recover key
                     $key = md5(USER_RECOVER_PASS_SALT . time() . $user->username . $user->email);
                     $user->email_recover_key = $key;
                     if ($user->save()) {
                         $ses = new SimpleEmailService(ConstantDefine::AMAZON_SES_ACCESS_KEY, ConstantDefine::AMAZON_SES_SECRET_KEY);
                         $ses->enableVerifyHost(false);
                         $m = new SimpleEmailServiceMessage();
                         $m->addTo($user->email);
                         $m->setFrom(ConstantDefine::AMAZON_SES_EMAIL);
                         $m->setSubject('[' . SITE_NAME . '] Password reset instructions');
                         $m_content = 'Hi ' . $user->display_name . '<br /><br />';
                         $m_content .= 'A request to reset your ' . SITE_NAME . ' password has been made. If you did not make this request, simply ignore this email. If you did make this request, just click the link below:<br /><br />';
                         $link_content = FRONT_SITE_URL . '/reset-password/?key=' . $user->email_recover_key . '&user_id=' . $user->user_id;
                         $m_content .= '<a href="' . $link_content . '">' . $link_content . '</a><br /><br />';
                         $m_content .= 'If the URL above does not work, try copying and pasting it into your browser.<br /><br />';
                         $m_content .= 'If you continue to have problems, please feel free to contact us: <a href="mailto:' . ConstantDefine::SUPPORT_EMAIL . '">' . ConstantDefine::SUPPORT_EMAIL . '</a><br /><br />';
                         $m_content .= 'Thank you for being with us!<br /><br />';
                         $m_content .= SITE_NAME . ' Team';
                         $m->setMessageFromString($m_content, $m_content);
                         $ses->sendEmail($m);
                         user()->setFlash('success', 'Instructions to reset your password have been sent to you. Please check your email.');
                         Yii::app()->controller->redirect(bu() . '/sign-in');
                     }
                 } else {
                     user()->setFlash('error', 'Email is not existed');
                 }
             }
         }
         $this->render(BlockRenderWidget::setRenderOutput($this), array('model' => $model));
     } else {
         echo '';
     }
 }
Ejemplo n.º 6
0
 public function sendEmail()
 {
     $email = str_replace('INTRODUCEE_NAME', $this->introducee->getName(), str_replace('OTHER_NAME', $this->other->getName(), str_replace('INTRODUCER_NAME', $this->userName, str_replace('LINK', $this->introductionUrl . '', Content::getInstance()->getEmail('email-introduction')))));
     $subject = str_replace('INTRODUCEE_NAME', $this->introducee->getName(), str_replace('INTRODUCER_NAME', $this->userName, Content::c()->introduce->email));
     // Send the email with AWS SES
     $ses = new SimpleEmailService(SES_KEY, SES_SECRET);
     $ses->enableVerifyHost(false);
     $ses->enableVerifyPeer(false);
     $m = new SimpleEmailServiceMessage();
     $m->addTo($this->introducee->getEmail());
     $m->setFrom(SES_FROM);
     $m->setSubject($subject);
     $m->setMessageFromString($subject . ' ' . $this->introductionUrl, $email);
     $result = $ses->sendEmail($m);
     if (!$result) {
         return false;
     }
     // Save the email result to the database
     $sth = $this->db->prepare('INSERT INTO aws_ses (recipient_id, ses_message_id, ses_request_id, introduction_id) VALUES (:recipient_id, :ses_message_id, :ses_request_id, :introduction_id)');
     $sth->execute(array(':recipient_id' => $this->introducee->getId(), ':ses_message_id' => $result['MessageId'], ':ses_request_id' => $result['RequestId'], ':introduction_id' => $this->introductionId));
     return true;
 }
Ejemplo n.º 7
0
 public function quickConnect()
 {
     $this->load->library('form_validation');
     $this->load->model('UserModel');
     $this->load->model('EmailModel');
     $name = $this->input->post('name');
     $email = $this->input->post('email');
     $subject = 'Quick Connect';
     $adminUsers = $this->UserModel->getAdminUsers();
     foreach ($adminUsers as $userAdmin) {
         $receiverAdminId[] = $userAdmin->id;
         $receiverAdminEmail[] = $userAdmin->email;
     }
     $emailId = $this->EmailModel->insertEmails('Success', $receiverAdminId);
     $link = '<a href="' . base_url(ADMIN_PATH . "mail/read_mail/" . $emailId) . '" target="_blank">here</a>';
     $emailMessage = "You've received email from " . $name . ". Click " . $link . " to view the message.";
     $this->load->library('SimpleEmailService');
     $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
     $ses->enableVerifyPeer(false);
     $m = new SimpleEmailServiceMessage();
     $m->addTo('*****@*****.**');
     $m->setFrom($email . '<' . EMAILSENDER . '>');
     $m->setSubject($subject);
     $message = $emailMessage;
     $m->setMessageFromString('', $message);
     if ($ses->sendEmail($m)) {
         if ($this->uri->segment(1) == 'Contact' || $this->uri->segment(1) == 'contact') {
             $this->session->set_flashdata("su_message", "Email Sent Successfully");
             redirect("home");
         } else {
             echo "<script>alert('Email Sent Successfully');window.history.back();</script>";
         }
     }
 }
Ejemplo n.º 8
0
 function sendEmailsToClient($email, $line_detail)
 {
     $site_link = '<a href="' . base_url('member') . '" target="_blank">here</a>';
     $emailMessage = "You hav been added to your card by owner for verify. " . $line_detail . ' ' . ' Click' . ' .' . $site_link . " to login ";
     $msg = $emailMessage;
     $subject = "Added to the Card For Verify";
     $this->load->library('SimpleEmailService');
     $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
     $ses->enableVerifyPeer(false);
     $m = new SimpleEmailServiceMessage();
     $m->addTo($email);
     $m->setFrom($email_sender . '<' . EMAILSENDER . '>');
     $m->setSubject($subject);
     $message = $msg;
     $m->setMessageFromString('', $message);
     $ses->sendEmail($m);
     $this->session->set_flashdata("su_message", "Email Sent Successfully...");
 }
Ejemplo n.º 9
0
function wpses_mail($to, $subject, $message, $headers = '', $attachments = '')
{
    global $SES;
    global $wpses_options;
    global $wp_better_emails;
    // headers can be sent as array, too. convert them to string to avoid further complications.
    if (is_array($headers)) {
        $headers = implode("\r\n", $headers);
    }
    if (is_array($to)) {
        $to = implode(",", $to);
    }
    extract(apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers')));
    wpses_log('wpses_mail ' . $to . "\t" . $headers);
    wpses_check_SES();
    if (isset($wp_better_emails)) {
        // From wpbe plugin, not efficient nor elegant - Will do better next time.
        // Could just call the php filter on a adhoc object, to be less dependant on the implementation of wpbe code.
        $txt = wp_specialchars_decode($message, ENT_QUOTES);
        $txt = $wp_better_emails->set_email_template($txt, 'plaintext_template');
        $txt = apply_filters('wpbe_plaintext_body', $wp_better_emails->template_vars_replacement($txt));
        /** HTML ******************************************************* */
        $html = $wp_better_emails->esc_textlinks($message);
        $html = nl2br(make_clickable($html));
        $html = $wp_better_emails->set_email_template($html);
        $html = apply_filters('wpbe_html_body', $wp_better_emails->template_vars_replacement($html));
    } else {
        $message = preg_replace('/<(http:.*)>/', '$1', $message);
        $message = preg_replace('/<(https:.*)>/', '$1', $message);
        // bad hack - handle httpS as well.
        $html = $message;
        $txt = strip_tags($html);
        if (strlen($html) == strlen($txt)) {
            $html = '';
            // que msg text
        }
        // no html entity in txt.
        $txt = html_entity_decode($txt, ENT_NOQUOTES, 'UTF-8');
    }
    // TODO: option pour que TXT si msg html, ou les deux comme ici par défaut.
    $m = new SimpleEmailServiceMessage();
    // To: may contain comma separated emails. If so, explode and add them all.
    // what to do if more than 50 ? (SES limit)
    if (preg_match('/,/im', $to)) {
        $to = explode(',', $to);
        foreach ($to as $toline) {
            $m->addTo($toline);
        }
    } else {
        $m->addTo($to);
    }
    $m->setReturnPath($wpses_options['return_path']);
    $from = $wpses_options['from_name'] . ' <' . $wpses_options['from_email'] . '>';
    if ('' != $wpses_options['reply_to']) {
        if ('headers' == strtolower($wpses_options['reply_to'])) {
            // extract replyto from headers
            $rto = array();
            //if (preg_match('/^Reply-To: ([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4})\b/imsU', $headers, $rto)) {
            //if (preg_match('/^Reply-To: (.*)\b/imsU', $headers, $rto)) {
            if (preg_match('/^Reply-To: (.*)/im', $headers, $rto)) {
                // does only support one email for now.
                $m->addReplyTo($rto[1]);
            }
            if (preg_match('/^From: (.*)/im', $headers, $rto)) {
                // Uses "From:" header - was /isU which broke things, see https://wordpress.org/support/topic/gravity-forms-18205-latest-contact-form-7-403-latest-not-working
                $from = $rto[1];
            }
            // Handle multiple cc and bcc: from headers too ? Guess so... TODO
            if ('' != $headers) {
                $headers = str_replace("\r\n", "\n", $headers);
                $lines = explode("\n", $headers);
                foreach ($lines as $line) {
                    if (preg_match('/^cc: (.*)/im', $line, $cc)) {
                        $m->addCC($cc[1]);
                    }
                    if (preg_match('/^Bcc: (.*)/im', $line, $Bcc)) {
                        $m->addBCC($Bcc[1]);
                    }
                }
            }
            // Test : use full headers if provided
            //$m->addCustomHeader($headers);
        } else {
            $m->addReplyTo($wpses_options['reply_to']);
        }
    }
    $m->setFrom($from);
    $m->setSubject($subject);
    if ($html == '') {
        // que texte
        $m->setMessageFromString($txt);
    } else {
        $m->setMessageFromString($txt, $html);
    }
    // Attachments
    if ('' != $attachments) {
        if (!is_array($attachments)) {
            $attachments = explode("\n", $attachments);
        }
        // Now we got an array
        foreach ($attachments as $afile) {
            $m->addAttachmentFromFile(basename($afile), $afile);
        }
    }
    set_error_handler('wpses_error_handler');
    $res = $SES->sendEmail($m);
    restore_error_handler();
    // Call custom Hook
    do_action('wpses_mailsent', $to, $subject, $message, $headers, $attachments);
    if (is_array($res)) {
        wpses_log('SES id=' . $res['MessageId']);
        return $res['MessageId'];
    } else {
        return NULL;
    }
}
Ejemplo n.º 10
0
            unset($insertList);
        }
    }
}
if ($formDet['form_type'] == 's') {
    $emailId = $_REQUEST['emailId'];
    if ($require_confirm == '1') {
        $confirmpageDet = $dbClass->getTableRecordSingle("form_page", "form_id=? and page_type=?", array($formId, 'confirmation'));
        $subscription_EmailId = $_REQUEST['emailId'];
        //$general->dump($confirmpageDet);
        if ($confirmpageDet['send_from_name'] != "") {
            $mail->setFrom($confirmpageDet['send_from_name'] . "<*****@*****.**>");
        } else {
            $mail->setFrom("*****@*****.**");
        }
        $mail->setSubject(stripslashes($confirmpageDet['email_subject']));
        $campaign_text_body = stripslashes($confirmpageDet['email_text']);
        $campaign_html_body = stripslashes($confirmpageDet['email_html']);
        if ($form_format == 'ft') {
            $body = $campaign_text_body;
        } else {
            $body = $campaign_html_body;
            $text_body = $campaign_text_body;
        }
        $confirmlink = $configDetails['siteUrl'] . "confirmform.php?form_submit_id=" . base64_encode($form_submit_id);
        $body1 = str_replace("%%CONFIRMLINK%%", $confirmlink, $body);
        $text_body1 = str_replace("%%CONFIRMLINK%%", $confirmlink, $text_body);
        $mail->setMessageFromString($text_body1, $body1);
        $mail->addTo($subscription_EmailId);
        $mail->addReplyTo("*****@*****.**");
        $mail->setReturnPath("*****@*****.**");
Ejemplo n.º 11
0
 /**
  * TrackEmailStatModel::sendTrackEmail()
  * 发送跟踪邮件
  * @param array $data 邮件内容
  * @return bool
  */
 public static function sendTrackEmail($data)
 {
     require_once WEB_PATH . 'lib/ses/SimpleEmailService.php';
     require_once WEB_PATH . 'lib/ses/SimpleEmailServiceRequest.php';
     require_once WEB_PATH . 'lib/ses/SimpleEmailServiceMessage.php';
     $smtpUser = $data['smtpUser'];
     $smtpPwd = $data['smtpPwd'];
     $smtpHost = $data['smtpHost'];
     $title = $data['title'];
     $content = $data['content'];
     $toUserEmail = $data['toUserEmail'];
     $toUserId = $data['toUserId'];
     $userEmail = $data['userEmail'];
     $userName = $data['userName'];
     $trackNum = $data['trackNumber'];
     $retryCount = $data['retryCount'];
     // print_r($data);
     // exit;
     //初始化邮件发送
     $ses = new SimpleEmailService($smtpUser, $smtpPwd);
     $m = new SimpleEmailServiceMessage();
     $m->addTo(array("{$toUserId} <{$toUserEmail}>"));
     //收件人
     $m->setFrom("{$userName} <{$userEmail}>");
     //发件人
     $m->setSubject($title);
     // 邮件标题
     $m->setMessageFromString(NULL, $content);
     //内容
     //设置标题和内容编码
     $m->setSubjectCharset('UTF-8');
     $m->setMessageCharset('UTF-8');
     $res = $ses->sendEmail($m);
     //发送邮件
     if (!empty($res['MessageId'])) {
         $flag = TransOpenApiModel::updateTrackNumber($trackNum, array("toEmailSend" => 1));
         if ($flag) {
             $res['sendFlag'] = 1;
         } else {
             $res['sendFlag'] = 2;
         }
     } else {
         $where = "trackNumber = '{$trackNum}' AND retryCount>='{$retryCount}' AND is_success = 0";
         $result = self::checkRetryCount($where);
         $counts = isset($result['retryCount']) ? intval($result['retryCount']) : 0;
         if ($counts >= $retryCount) {
             $flag = TransOpenApiModel::updateTrackNumber($trackNum, array("toEmailSend" => 2));
         }
         $res['sendFlag'] = 0;
     }
     return $res;
 }
Ejemplo n.º 12
0
 function sendEmails($email, $link)
 {
     $emailMessage = "You've received email from " . $this->session->userdata(NAME) . ". Click " . $link . " to view the message.";
     $receiverUserInfo = $this->UserModel->getUserByEmail($email);
     $receiverName = $receiverUserInfo->first_name . ' ' . $receiverUserInfo->middle_initial . ' ' . $receiverUserInfo->last_name;
     $user_id = $this->session->userdata(USER_ID);
     $user_details = $this->UserModel->getUser($user_id);
     $email_sender = $user_details->first_name . ' ' . $user_details->middle_initial . ' ' . $user_details->last_name;
     $msg = $emailMessage;
     $subject = $this->input->post('subject');
     $this->load->library('SimpleEmailService');
     $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
     $ses->enableVerifyPeer(false);
     $m = new SimpleEmailServiceMessage();
     $m->addTo($email);
     $m->setFrom($email_sender . '<' . EMAILSENDER . '>');
     $m->setSubject($subject);
     $data = array('receiver' => $receiverName, 'emailer' => $email_sender, 'message' => $msg);
     $code = $this->parser->parse('administrator/mailed_template', $data);
     $m->setMessageFromString('', $code);
     $ses->sendEmail($m);
     $this->session->set_flashdata("su_message", "Email Sent Successfully...");
     redirect(ADMIN_PATH . "mail/compose");
 }
 /**
  * Sends an Email to the Committer with the details
  *
  * @param Array $problems Problems
  *
  * @return void
  */
 public function sendEmail($problems)
 {
     $committer = $this->getCommitterDetails();
     $subject = "Coding Standards information about your Commit #" . $this->getCommitId();
     $message = 'Hey ' . $committer['name'] . ",\n\n";
     $message .= "We've found the following coding standards ";
     $message .= "notifications in your recent commit:\n\n";
     foreach ($problems as $problem) {
         $message .= 'File: ' . $problem['file'] . "\n";
         $message .= 'Type: ' . $problem['type'] . "\n\n";
         foreach ($problem['description'] as $line) {
             $message .= $line . "\n";
         }
         $message .= "\n";
     }
     $message .= "Sincerely,\n\nThe Coding Standards Validator Robot";
     $ses = new SimpleEmailService(SES_ACCESS, SES_SECRET);
     $mail = new SimpleEmailServiceMessage();
     $mail->addTo($committer['email']);
     $mail->setFrom(SES_EMAIL);
     $mail->setSubject($subject);
     $mail->setMessageFromString($message);
     $ses->sendEmail($mail);
 }
Ejemplo n.º 14
0
 function resetPassword()
 {
     $code = $this->autoGenerateCode();
     $email_to = $this->input->post('email');
     $answer_1 = $this->input->post('answer1');
     $answer_2 = $this->input->post('answer2');
     $result = $this->UserModel->checkQuestionsAnswers($email_to, $answer_1, $answer_2);
     $id = $this->UserModel->checkEmailId($email_to);
     if (!empty($id) && !empty($result)) {
         $this->UserModel->updateProfile(null, $id, $code);
         $subject = "Forgot Password";
         $message = "Click on the following link to reset your password";
         $this->load->library('SimpleEmailService');
         $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
         $ses->enableVerifyPeer(false);
         $m = new SimpleEmailServiceMessage();
         $from = '*****@*****.**';
         $m->addTo($email_to);
         $m->setFrom($from . '<' . EMAILSENDER . '>');
         $m->setSubject($subject);
         $msg = $message;
         $msg .= '<br/><a href="' . base_url() . 'member/changePassword' . '/' . $code . '">CLICK HERE</a>';
         $m->setMessageFromString('', $msg);
         $ses->sendEmail($m);
         $this->session->set_flashdata('message', "<b style=\"color:green; alignment:center;\" >Please refer to your email. The reset link has been send to your email successfully.</b>");
         redirect(base_url() . 'member/forgotpassword');
     } else {
         $this->session->set_flashdata('message', "<b style=\"color:red;\">Contact Broker For Difficulties</b>");
         redirect(base_url() . 'member/forgotpassword');
     }
 }
Ejemplo n.º 15
0
 public function sendEmails($emails, $subject, $templateId, $userId, $full_name = '', $other = '')
 {
     $this->load->library('SimpleEmailService');
     $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
     $ses->enableVerifyPeer(false);
     $simpleEmailServiceMessage = new SimpleEmailServiceMessage();
     if (!empty($emails)) {
         $simpleEmailServiceMessage->addTo($emails);
     } else {
         $simpleEmailServiceMessage->addTo($other);
     }
     $simpleEmailServiceMessage->setFrom('The Credit University' . '<' . EMAILSENDER . '>');
     $simpleEmailServiceMessage->setSubject($subject);
     if (empty($other)) {
         $code = $this->getInterpretedNewsLetterTemplate($templateId, $full_name, $userId, $this->NewsLetterModel->getCampaignId($templateId), $other = '');
     } else {
         $code = $this->getInterpretedNewsLetterTemplate($templateId, $full_name = '', $userId, $this->NewsLetterModel->getCampaignId($templateId), $other);
     }
     $simpleEmailServiceMessage->setMessageFromString('', $code);
     $sent = $ses->sendEmail($simpleEmailServiceMessage);
     return $sent;
 }
Ejemplo n.º 16
0
    function sendEmails()
    {
        $user_id = $this->session->userdata(USER_ID);
        $user_role_details = $this->RoleModel->getRolesByUserId($user_id);
        $email_sender_type = $user_role_details->value;
        $user_details = $this->UserModel->getUser($user_id);
        $email_sender = $user_details->first_name . ' ' . $user_details->middle_initial . ' ' . $user_details->last_name;
        $subject = $this->input->post('subject');
        $to_emails = $this->input->post('toemails[]');
        $msg = $this->input->post('msg');
        $name = $this->UserModel->getNameFromEmail($to_emails);
        $role_name = $this->UserModel->getRoleFromEmail($to_emails);
        $user_ids = $this->UserModel->getUserIdFromEmail($to_emails);
        $this->load->library('SimpleEmailService');
        $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
        $ses->enableVerifyPeer(false);
        $m = new SimpleEmailServiceMessage();
        $m->addTo($to_emails);
        $m->setFrom($email_sender . '<' . EMAILSENDER . '>');
        $m->setSubject($subject);
        $msg = '<html>
									<head>
									<meta charset="utf-8">
									<title>Email Template</title>
									</head>
								<body>
									<div class="box" style="padding:0px;width:40%; margin:0 auto;-webkit-border-radius: 5px;
									-moz-border-radius: 5px;
									border-radius: 5px; border:1px solid #ccc;">
									<div class="title" style="-webkit-border-top-left-radius: 5px;
								-webkit-border-top-right-radius: 5px;
								-moz-border-radius-topleft: 5px;
								-moz-border-radius-topright: 5px;
						border-top-left-radius: 5px;
								border-top-right-radius: 5px; background:#ccc; color:#fff;">
								<h3 style="padding:10px; margin:0px; color:#ac6f00;"><img src="' . base_url() . 'frontend/images/logo.png" height="35px" style="vertical-align:middle;margin-right:15px;">The Credit University</h3>
								</div>
								<div class="content" style="padding:10px; font-size:14px;"><p style="font-size:13px;">';
        $msg .= 'Dear User,<br/>';
        $msg .= $this->input->post('msg');
        $msg .= '<br/><br/>';
        $msg .= 'Yours Sincerely,<br/>';
        $msg .= $email_sender;
        $msg .= 'Americancpn <br/>';
        // footer part of email template
        $msg .= '</p></div>
								<div class="footer" style="-webkit-border-bottom-right-radius: 5px;
								-webkit-border-bottom-left-radius: 5px;
							-moz-border-radius-bottomright: 5px;
							-moz-border-radius-bottomleft: 5px;
							border-bottom-right-radius: 5px;
							border-bottom-left-radius: 5px;background:#ccc; color:#ac6f00; margin:0px; padding:1px 10px;">
							<p>Yours Sincerely,<br>
							The Credit University Team</p>
							</div>
							</div>
							</body>
						</html>';
        $message = $msg;
        $m->setMessageFromString('', $message);
        if ($ses->sendEmail($m)) {
            $this->EmailModel->insertEmails('Success', $email_sender, $email_sender_type, $name, $role_name, $user_ids);
            redirect(ADMIN_PATH . "user/mailbox");
        } else {
            redirect(ADMIN_PATH . "user/compose");
        }
    }
Ejemplo n.º 17
0
// Now we need member id of campaign...  later we'll need list id... we can probably do this as part of the same query with a join
// while we're at it, let's get the message details?
$now = date('Y-m-d G:i:s', strtotime("now"));
$sql = "SELECT \r\nXJ.XE_JOB_ID AS JID,\r\nXJ.XE_JOB_CAMPAIGN_ID AS CID,\r\nXC.XE_CAMPAIGN_MID AS MID,\r\nXM.XE_MSG_FROM_LABEL AS FROM_LABEL,\r\nXM.XE_MSG_FROM_EMAIL AS FROM_EMAIL,\r\nXM.XE_MSG_SUBJECT AS SUBJECT,\r\nXM.XE_MSG_REPLY_TO AS REPLYTO,\r\nXM.XE_MSG_UNSUBSCRIBE AS UNSUBSCRIBE,\r\nXM.XE_MSG_POSTAL_ADDRESS AS ADDRESS,\r\nXM.XE_MSG_TEMPLATE_TEXT AS MSG_TXT,\r\nXM.XE_MSG_TEMPLATE_HTML AS MSG_HTML\r\nFROM XEBURA_JOBS AS XJ\r\nJOIN XEBURA_CAMPAIGN AS XC ON XJ.XE_JOB_CAMPAIGN_ID = XC.XE_CAMPAIGN_ID\r\nJOIN XEBURA_MESSAGE  AS XM ON XJ.XE_JOB_CAMPAIGN_ID = XM.XE_MSG_CAMPAIGN_ID\r\nWHERE XE_JOB_LAUNCH <= '" . $now . "'\r\nAND XE_JOB_STATUS = '0'";
//job status 0 = pending
// now that we've got the campaigns, we need to loop over them.. this is our outer loop
$db->query($sql);
$result = $db->query($sql);
$total_items = $db->getNumRows($result);
if ($db->getNumRows($result) > 0) {
    while (list($jid, $cid, $mid, $from_label, $from_email, $subject, $replyto, $unsubscribe, $address, $msg_txt, $msg_html) = $db->fetchQueryRow($result)) {
        // now for our inner loop, let's find out who we're supposed to send this campaign out to, and loop over them.
        // need to add check for sending allowed status to this query later
        // remove LIMIT
        $sql = "SELECT \r\nXE_ADDRESS_ID,\r\nXE_ADDRESS_EMAIL,\r\nXE_ADDRESS_FNAME\r\nFROM XEBURA_MASTER_LIST\r\nWHERE XE_ADDRESS_MID = '" . $mid . "'\r\nLIMIT 5";
        $db->query($sql);
        $result = $db->query($sql);
        $total_items = $db->getNumRows($result);
        if ($db->getNumRows($result) > 0) {
            while (list($eid, $email, $fname) = $db->fetchQueryRow($result)) {
                //SEND THE EMAIL
                $m = new SimpleEmailServiceMessage();
                $m->addTo($email);
                $m->setFrom($from_email);
                $m->setSubject($subject);
                $m->setMessageFromString($msg_html);
                print_r($ses->sendEmail($m));
            }
        }
    }
}
Ejemplo n.º 18
0
    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        include_once "/opt/nginx/html/laravel/vendor/SmartImage.class.php";
        try {
            $hash = $this->option('hash');
            $media = Media::where('hash', '=', $hash)->first();
            if ($media->files()->count() == 0) {
                echo "files";
                $url = 'http://s01.okaydrive.com/rt/plugins/httprpc/action.php';
                $myvars = 'mode=info&hash=' . $hash;
                $ch = curl_init($url);
                $username = '******';
                $password = '******';
                curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $response = curl_exec($ch);
                $torrent_info = json_decode($response, true);
                $url = 'http://s01.okaydrive.com/rt/plugins/httprpc/action.php';
                $myvars = 'mode=fls&hash=' . $hash;
                $ch = curl_init($url);
                $username = '******';
                $password = '******';
                curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
                curl_setopt($ch, CURLOPT_POST, 1);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_HEADER, 0);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                $response = curl_exec($ch);
                $torrent_files = json_decode($response, true);
                $files = $torrent_files;
                if (!empty($files)) {
                    echo "not empty";
                    echo count($files);
                    $ignore_first_folder = true;
                    $id = 1;
                    $paths = array();
                    foreach ($files as $file) {
                        if ($torrent_info[3] != 0) {
                            $fd = parse_url(basename(str_replace("#", "", $torrent_info[2])) . '/' . str_replace("#", "", $file[0]));
                        } else {
                            $fd = parse_url(str_replace("#", "", $file[0]));
                        }
                        $path_parts = pathinfo($fd['path']);
                        $dirs = explode("/", $path_parts['dirname']);
                        for ($i = 0; $i <= count($dirs); $i++) {
                            if (isset($dirs[$i]) && $dirs[$i] != '.') {
                                $full_path = $this->fullpath($dirs, $i);
                                if (array_key_exists($full_path, $paths)) {
                                } else {
                                    $paths[$full_path]["id"] = $id;
                                    $paths[$full_path]["name"] = $dirs[$i];
                                    $prev_path = $this->fullpath($dirs, $i - 1);
                                    if (!isset($paths[$prev_path]["id"])) {
                                        $pv_p = 0;
                                    } else {
                                        $pv_p = $paths[$prev_path]["id"];
                                    }
                                    $new_folder = new MediaFlag();
                                    $new_folder->name = $dirs[$i];
                                    $new_folder->folder_id = $id;
                                    $new_folder->in = $pv_p;
                                    $new_folder->media_id = $media->id;
                                    $new_folder->save();
                                    $id++;
                                }
                            } elseif (isset($dirs[$i]) && $dirs[$i] == '.') {
                                //echo $path_parts["basename"].' 0';
                                $new_file = new MediaLike();
                                if ($torrent_info[3] != 0) {
                                    $new_file->path = basename(str_replace("#", "", $torrent_info[2])) . '/' . str_replace("#", "", $file[0]);
                                } else {
                                    $new_file->path = str_replace("#", "", $file[0]);
                                }
                                $new_file->name = $path_parts["basename"];
                                $new_file->type = $this->getExt($new_file->path);
                                $new_file->in = 0;
                                $new_file->size = $file[3];
                                $new_file->media_id = $media->id;
                                //$like->user_id = Auth::user()->id;
                                $new_file->save();
                                $ignore_first_folder = false;
                            } else {
                                if (isset($dirs[$i - 1]) && $dirs[$i - 1] != '.') {
                                    $full_path = $this->fullpath($dirs, $i - 1);
                                    //echo $path_parts["basename"].' '.$paths[$full_path]["id"];
                                    $new_file = new MediaLike();
                                    if ($torrent_info[3] != 0) {
                                        $new_file->path = basename(str_replace("#", "", $torrent_info[2])) . '/' . str_replace("#", "", $file[0]);
                                    } else {
                                        $new_file->path = str_replace("#", "", $file[0]);
                                    }
                                    $new_file->type = $this->getExt($new_file->path);
                                    $new_file->name = $path_parts["basename"];
                                    $new_file->in = $paths[$full_path]["id"];
                                    $new_file->size = $file[3];
                                    $new_file->media_id = $media->id;
                                    //$like->user_id = Auth::user()->id;
                                    $new_file->save();
                                }
                            }
                        }
                    }
                    $media["ignore_first"] = $ignore_first_folder;
                    $media->save();
                }
            }
            $files_local = $media->getFiles();
            if (!empty($files_local)) {
                echo "pro";
                $media_id = $media->id;
                shell_exec('nohup php /opt/nginx/html/artisan check:files --media=' . $media_id . ' > /dev/null 2>&1 & echo $!');
                $max_file_id = null;
                $max_file_size = 0;
                foreach ($files_local as $file) {
                    if ($file->type == "vid" || $file->type == "vid-conv") {
                        if ($file->size > $max_file_size) {
                            $max_file_size = $file->size;
                            $max_file_id = $file->id;
                        }
                    }
                }
                $media->max_file_id = $max_file_id;
                $media->save();
                $fast = false;
                foreach ($files_local as $file) {
                    if ($file->type == "vid" || $file->type == "vid-conv") {
                        if ($file->type == "vid") {
                            $fast = $this->getFast($file->path);
                        }
                        if ($file->id == $max_file_id) {
                            $info = $this->makeThumbs($media->id, $file->id, $media->id . '/' . $file->path, $fast, 13);
                        } else {
                            $info = $this->makeThumbs($media->id, $file->id, $media->id . '/' . $file->path, $fast, 1);
                        }
                        if (!empty($info) && $info != null) {
                            $info_decode_all = json_decode($info, true);
                            $info_decode = $info_decode_all["data"];
                            $new_fileinfo = new FileInfo();
                            $new_fileinfo->file_id = $file->id;
                            $new_fileinfo->media_id = $media->id;
                            $new_fileinfo->video_duration = $info_decode["video_duration"];
                            $new_fileinfo->video_codec_name = $info_decode["video_codec_name"];
                            $new_fileinfo->video_width = $info_decode["video_width"];
                            $new_fileinfo->video_height = $info_decode["video_height"];
                            $new_fileinfo->video_height = $info_decode["video_height"];
                            $new_fileinfo->video_ratio = $info_decode["video_ratio"];
                            $new_fileinfo->video_fps = $info_decode["video_fps"];
                            $new_fileinfo->audio_codec_name = $info_decode["audio_codec_name"];
                            $new_fileinfo->audio_bit_rate = $info_decode["audio_bit_rate"];
                            $new_fileinfo->save();
                        }
                    } elseif ($file->type == "img") {
                        //$this->setimages($file->name ,$media->id . '/'. $file->path);
                        $file_path_thumb = '/opt/nginx/html/public/cache/thumbs/' . $file->id . '.jpg';
                        $full_path = '/home/mfs/Downloads/transmission/completed/' . $media->id . '/' . $file->path;
                        if (file_exists($file_path_thumb)) {
                            unlink($file_path_thumb);
                        }
                        try {
                            $img = new SmartImage($full_path);
                            $img->resize(130, 130, true);
                            $img->saveImage($file_path_thumb, 85);
                        } catch (Exception $e) {
                            $full_path = '/home/mfs/Downloads/transmission/image.png';
                            $img = new SmartImage($full_path);
                            $img->saveImage($file_path_thumb, 85);
                        }
                        //file_put_contents($file_path_thumb, $file_img_tmp);
                    }
                }
                sleep(10);
                $save_base_thumbs = "/opt/nginx/html/public/snaps/thumbs/";
                $save_base_big = "/opt/nginx/html/public/snaps/big/";
                foreach ($files_local as $file) {
                    if ($file->type == "vid" || $file->type == "vid-conv") {
                        $snap_big_path = $save_base_big . $media->id;
                        if (!file_exists($snap_big_path)) {
                            mkdir($snap_big_path, 0775, true);
                        }
                        $snap_big_path_full = $snap_big_path . '/' . $file->id;
                        if (!file_exists($snap_big_path_full)) {
                            mkdir($snap_big_path_full, 0775, true);
                        }
                        $snap_thumb_path = $save_base_thumbs . $media->id;
                        if (!file_exists($snap_thumb_path)) {
                            mkdir($snap_thumb_path, 0775, true);
                        }
                        $snap_thumb_path_full = $snap_thumb_path . '/' . $file->id;
                        if (!file_exists($snap_thumb_path_full)) {
                            mkdir($snap_thumb_path_full, 0775, true);
                        }
                        if ($media->max_file_id != $file->id) {
                            $file_get = '/opt/nginx/html/laravel/public/snaps/' . $media->id . '/' . $file->id . '/1.jpg';
                            $snap_big_path_full_file = $snap_big_path_full . '/1.jpg';
                            $snap_thumb_path_full_file = $snap_thumb_path_full . '/1.jpg';
                            if (file_exists($snap_big_path_full_file)) {
                            } else {
                                try {
                                    $file_img = file_get_contents($file_get);
                                    file_put_contents($snap_big_path_full_file, $file_img);
                                    $img = new SmartImage($snap_big_path_full_file);
                                    $img->resize(130, 130, true);
                                    $img->saveImage($snap_thumb_path_full_file, 85);
                                } catch (Exception $e) {
                                    $img = new SmartImage('/opt/nginx/html/app/commands/1.png');
                                    $img->resize(130, 130, true);
                                    $img->saveImage($snap_thumb_path_full_file, 85);
                                }
                            }
                        } elseif ($media->max_file_id == $file->id) {
                            $frames = 13;
                            for ($k = 1; $k < $frames; $k++) {
                                $snap_big_path_full_file = $snap_big_path_full . '/' . $k . '.jpg';
                                $snap_thumb_path_full_file = $snap_thumb_path_full . '/' . $k . '.jpg';
                                $file_get = '/opt/nginx/html/laravel/public/snaps/' . $media->id . '/' . $file->id . '/' . $k . '.jpg';
                                if (file_exists($snap_big_path_full_file)) {
                                } else {
                                    try {
                                        $file_img = file_get_contents($file_get);
                                        file_put_contents($snap_big_path_full_file, $file_img);
                                        $img = new SmartImage($snap_big_path_full_file);
                                        $img->resize(130, 130, true);
                                        $img->saveImage($snap_thumb_path_full_file, 85);
                                    } catch (Exception $e) {
                                        $img = new SmartImage('/opt/nginx/html/app/commands/1.png');
                                        $img->resize(130, 130, true);
                                        $img->saveImage($snap_thumb_path_full_file, 85);
                                    }
                                }
                            }
                        }
                    }
                }
                while (MediaLike::where('media_id', '=', $media->id)->where('cksum', '=', '')->count() != 0) {
                    sleep(1);
                }
                $media["state"] = 'done';
                $media->save();
                $media_users = $media->usersMedia();
                foreach ($media_users as $media_user) {
                    try {
                        $user_this = User::where('id', '=', $media_user->user_id)->first();
                        if (isset($user_this->email) && $user_this->ea) {
                            require_once '/opt/nginx/html/vendor/php-aws-ses-master/src/ses.php';
                            $ses = new SimpleEmailService('AKIAJNUKDR6WQV2PJLEA', 'Q0p4SCDdHK5QddvUICYj/xMfoAbcxa7buuRYTJyY');
                            $m = new SimpleEmailServiceMessage();
                            $m->addTo($user_this->email);
                            $m->setFrom('DATAS Support <*****@*****.**>');
                            $m->setSubject('Your files are ready to download.');
                            $html = '<table class="yiv7962433916container" align="center" cellspacing="0" border="0" cellpadding="0" width="580" bgcolor="#FFFFFF" style="width:580px;background-color:#FFF;border-top:1px solid #DDD;border-bottom:1px solid #DDD;" id="yui_3_13_0_1_1397466773730_2821">
												<tbody id="yui_3_13_0_1_1397466773730_2820"><tr id="yui_3_13_0_1_1397466773730_2819">
													<td class="yiv7962433916title" style="padding-top:34px;padding-left:39px;padding-right:39px;text-align:left;border-left-width:1px;border-left-style:solid;border-left-color:#DDD;border-right-width:1px;border-right-style:solid;border-right-color:#DDD;" id="yui_3_13_0_1_1397466773730_2818">
														<h2 style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;font-size:30px;color:#262626;font-weight:normal;margin-top:0;margin-bottom:13px;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;letter-spacing:0;" id="yui_3_13_0_1_1397466773730_2817">Your file is ready!</h2>
														<h3 style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;font-size:16px;color:#3e434a;font-weight:normal;margin-top:0;margin-bottom:19px;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;line-height:25px;" id="yui_3_13_0_1_1397466773730_2824">The file <b>' . $media->title . '</b> has been downloaded and ready to Play, Download, Convert or Stream.</h3>
													</td>
												</tr>
												<tr id="yui_3_13_0_1_1397466773730_2831">
													<td class="yiv7962433916cta" align="left" style="background-color:#F1FAFE;font-size:14px;color:#1f1f1f;border-top-width:1px;border-top-style:solid;border-top-color:#DAE3EA;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#DAE3EA;border-left-width:1px;border-left-style:solid;border-left-color:#DDD;border-right-width:1px;border-right-style:solid;border-right-color:#DDD;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:20px;padding-bottom:20px;padding-right:39px;padding-left:39px;text-align:left;" id="yui_3_13_0_1_1397466773730_2830">
														<table cellspacing="0" border="0" cellpadding="0" width="500" align="left">
															<tbody><tr>
																<td width="24"></td>
																<td class="yiv7962433916link" align="left" style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;padding-left:9px;font-size:14px;"><strong><a rel="nofollow" style="color:#2b6cb5;font-family:Arial;font-size:12px;" target="_blank" href="https://okaydrive.com/torrent/' . $media_user->uni_id . '">Click here to go to your file</a></strong></td>
															</tr>
														</tbody></table>
													</td>
												</tr>
												<tr id="yui_3_13_0_1_1397466773730_2827">
													<td class="yiv7962433916footer" style="color:#797c80;font-size:12px;border-left-width:1px;border-left-style:solid;border-left-color:#DDD;border-right-width:1px;border-right-style:solid;border-right-color:#DDD;padding-top:23px;padding-left:39px;padding-right:13px;padding-bottom:23px;text-align:left;" id="yui_3_13_0_1_1397466773730_2826">
														<p style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:13px;padding-right:0;padding-left:0;line-height:20px;" id="yui_3_13_0_1_1397466773730_2832">
															You can login with <a rel="nofollow" style="font-weight:bold;text-decoration:none;color:inherit;cursor:default;">' . $user_this->username . '</a> at <a rel="nofollow" target="_blank" href="https://okaydrive.com" id="yui_3_13_0_1_1397466773730_2833">https://okaydrive.com</a>
														</p>
														<p style="font-family:Helvetica Neue, Arial, Helvetica, sans-serif;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:13px;padding-right:0;padding-left:0;line-height:20px;" id="yui_3_13_0_1_1397466773730_2825">Want some help with using our site? Simply reply to this email or email us - support@okaydrive.com. Email alerts are enabled by default, you may disable email alerts in your account settings.</p>
													</td>
												</tr>
												<tr>
											</tr></tbody></table>';
                            $m->setMessageFromString('', $html);
                            $ses->sendEmail($m);
                        }
                    } catch (Exception $e) {
                    }
                }
            }
        } catch (Exception $e) {
            file_put_contents('/home/mfs/l.log', $e);
        }
    }
Ejemplo n.º 19
0
function wpses_mail($to, $subject, $message, $headers = '', $attachments = '')
{
    global $SES;
    global $wpses_options;
    global $wp_better_emails;
    // headers can be sent as array, too. convert them to string to avoid further complications.
    if (is_array($headers)) {
        $headers = implode("\r\n", $headers);
    }
    extract(apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers')));
    wpses_check_SES();
    if (isset($wp_better_emails)) {
        // From wpbe plugin, not efficient nor elegant - Will do better next time.
        // Could just call the php filter on a adhoc object, to be less dependant on the implementation of wpbe code.
        $txt = wp_specialchars_decode($message, ENT_QUOTES);
        $txt = $wp_better_emails->set_email_template($txt, 'plaintext_template');
        $txt = apply_filters('wpbe_plaintext_body', $wp_better_emails->template_vars_replacement($txt));
        /** HTML ******************************************************* */
        $html = $wp_better_emails->esc_textlinks($message);
        $html = nl2br(make_clickable($html));
        $html = $wp_better_emails->set_email_template($html);
        $html = apply_filters('wpbe_html_body', $wp_better_emails->template_vars_replacement($html));
    } else {
        $message = preg_replace('/<(http:.*)>/', '$1', $message);
        $html = $message;
        $txt = strip_tags($html);
        if (strlen($html) == strlen($txt)) {
            $html = '';
            // que msg text
        }
        // no html entity in txt.
        $txt = html_entity_decode($txt, ENT_NOQUOTES, 'UTF-8');
    }
    // TODO: option pour que TXT si msg html, ou les deux comme ici par défaut.
    $m = new SimpleEmailServiceMessage();
    $m->addTo($to);
    $m->setReturnPath($wpses_options['return_path']);
    $from = '"' . $wpses_options['from_name'] . '" <' . $wpses_options['from_email'] . ">";
    if ('' != $wpses_options['reply_to']) {
        if ('headers' == strtolower($wpses_options['reply_to'])) {
            // extract replyto from headers
            $rto = array();
            if (preg_match('/^Reply-To: ([a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4})\\b/imsU', $headers, $rto)) {
                // does only support one email for now.
                $m->addReplyTo($rto[1]);
            }
            if (preg_match('/^From: (.*)/isU', $headers, $rto)) {
                // Uses "From:" header
                $from = $rto[1];
            }
        } else {
            $m->addReplyTo($wpses_options['reply_to']);
        }
    }
    $m->setFrom($from);
    $m->setSubject($subject);
    if ($html == '') {
        // que texte
        $m->setMessageFromString($txt);
    } else {
        $m->setMessageFromString($txt, $html);
    }
    // Attachments
    if ('' != $attachments) {
        if (!is_array($attachments)) {
            $attachments = explode("\n", $attachments);
        }
        // Now we got an array
        foreach ($attachments as $afile) {
            $m->addAttachmentFromFile(basename($afile), $afile);
        }
    }
    $res = $SES->sendEmail($m);
    if (is_array($res)) {
        return $res['MessageId'];
    } else {
        return NULL;
    }
}
    public function paymentProcess()
    {
        if ($_SERVER['REQUEST_METHOD'] == "POST") {
            $id = $_POST['custom'];
            list($aid, $cid) = explode('-', $id);
            $affinfo = $this->ClientModel->getAffiliatePaymentInfo($aid);
            // Check Number 1 ------------------------------------------------------------------------------------------------------------
            $receiver_email = $_POST['receiver_email'];
            if ($receiver_email == $affinfo->affiliate_paypal_account) {
                $payment_amount = $_POST['mc_gross'];
                if ($payment_amount == $affinfo->affiliate_client_reg_charge) {
                    // Check number 2 ------------------------------------------------------------------------------------------------------------
                    if ($_POST['payment_status'] == "Completed") {
                        // Handle how you think you should if a payment is not complete yet, a few scenarios can cause a transaction to be incomplete
                        // incs('config/dbcon.php');
                        // assign posted variables to local variables
                        $pstatus = $_POST['payment_status'];
                        $pamount = $_POST['mc_gross'];
                        $txn_id = $_POST['txn_id'];
                        $payer_email = $_POST['payer_email'];
                        $id = $_POST['custom'];
                        list($aid, $cid) = explode('-', $id);
                        $paytitle = $_POST['item_name1'];
                        $updatepayment = $this->ClientModel->paypalPaymentInsert($aid, $cid, $paytitle, $pamount, $payer_email, $txn_id, $pstatus);
                        // if ($updatepayment!='') {
                        $subject = 'Client Registration Payment';
                        // header part of email template
                        $msg = '<html>
										<head>
										<meta charset="utf-8">
										<title>Email Template</title>
										
										</head>
										
										<body>
										<div class="box" style="padding:0px;width:40%; margin:0 auto;-webkit-border-radius: 5px;
										-moz-border-radius: 5px;
										border-radius: 5px; border:1px solid #ccc;">
										<div class="title" style="-webkit-border-top-left-radius: 5px;
										-webkit-border-top-right-radius: 5px;
										-moz-border-radius-topleft: 5px;
										-moz-border-radius-topright: 5px;
										border-top-left-radius: 5px;
										border-top-right-radius: 5px; background:#ccc; color:#fff;">
										<h3 style="padding:10px; margin:0px; color:#ac6f00;"><img src="' . base_url() . 'frontend/images/logo.png" height="35px" style="vertical-align:middle;margin-right:15px;">The Credit University</h3>
										</div>
										<div class="content" style="padding:10px; font-size:14px;"><p style="font-size:13px;">';
                        $msg .= 'Payment Successfully completed. Please login <a href="' . base_url() . 'admin"> Click Here</a>';
                        // footer part of email template
                        $msg .= '</p></div>
									<div class="footer" style="-webkit-border-bottom-right-radius: 5px;
									-webkit-border-bottom-left-radius: 5px;
									-moz-border-radius-bottomright: 5px;
									-moz-border-radius-bottomleft: 5px;
									border-bottom-right-radius: 5px;
									border-bottom-left-radius: 5px;background:#ccc; color:#ac6f00; margin:0px; padding:1px 10px;">
									
									</div>
									</div>
									</body>
									</html>';
                        $this->load->library('SimpleEmailService');
                        $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
                        $ses->enableVerifyPeer(false);
                        //print_r($ses->verifyEmailAddress('*****@*****.**'));
                        $m = new SimpleEmailServiceMessage();
                        $m->addTo('contact <' . $updatepayment->email . '>');
                        $m->setFrom('The Credit University' . '<' . EMAILSENDER . '>');
                        $m->setSubject($subject);
                        $message = $msg;
                        $m->setMessageFromString('', $message);
                        $ses->sendEmail($m);
                        // }
                    }
                    //payment_status check
                }
            }
        } else {
            $subject = 'Fail CPN referrer Partner Registration Payment';
            $msg = '<html>
										<head>
										<meta charset="utf-8">
										<title>Email Template</title>
										
										</head>
										
										<body>
										<div class="box" style="padding:0px;width:40%; margin:0 auto;-webkit-border-radius: 5px;
										-moz-border-radius: 5px;
										border-radius: 5px; border:1px solid #ccc;">
										<div class="title" style="-webkit-border-top-left-radius: 5px;
										-webkit-border-top-right-radius: 5px;
										-moz-border-radius-topleft: 5px;
										-moz-border-radius-topright: 5px;
										border-top-left-radius: 5px;
										border-top-right-radius: 5px; background:#ccc; color:#fff;">
										<h3 style="padding:10px; margin:0px; color:#ac6f00;"><img src="' . base_url() . 'frontend/images/logo.png" height="35px" style="vertical-align:middle;margin-right:15px;">The Credit University</h3>
										</div>
										<div class="content" style="padding:10px; font-size:14px;"><p style="font-size:13px;">';
            $msg .= 'Payment Failed.';
            // footer part of email template
            $msg .= '</p></div>
									<div class="footer" style="-webkit-border-bottom-right-radius: 5px;
									-webkit-border-bottom-left-radius: 5px;
									-moz-border-radius-bottomright: 5px;
									-moz-border-radius-bottomleft: 5px;
									border-bottom-right-radius: 5px;
									border-bottom-left-radius: 5px;background:#ccc; color:#ac6f00; margin:0px; padding:1px 10px;">
									
									</div>
									</div>
									</body>
									</html>';
            $this->load->library('SimpleEmailService');
            $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
            $ses->enableVerifyPeer(false);
            //print_r($ses->verifyEmailAddress('*****@*****.**'));
            $m = new SimpleEmailServiceMessage();
            $m->addTo('contact <*****@*****.**>');
            $m->setFrom('The Credit University' . '<' . EMAILSENDER . '>');
            $m->setSubject($subject);
            $message = $msg;
            $m->setMessageFromString('', $message);
            $ses->sendEmail($m);
        }
    }
Ejemplo n.º 21
0
<?php

error_reporting(E_ALL);
require_once 'SimpleEmailService.php';
require_once 'SimpleEmailServiceRequest.php';
require_once 'SimpleEmailServiceMessage.php';
$ses = new SimpleEmailService('AKIAJPVRUB4LGXGH3TIA', 'KnbZBhbold1tmaKXJTQWkojbN/U0Ui90LmzNb/VW');
// print_r($ses->verifyEmailAddress('*****@*****.**'));
$m = new SimpleEmailServiceMessage();
$m->addTo('*****@*****.**');
//收件人
// $m->addCC(array('*****@*****.**','*****@*****.**')); //抄送 收件人
// $m->addBCC('*****@*****.**'); //密送 收件人
$m->setFrom('*****@*****.**');
//发件人
$m->setSubject('Hello, world!');
// 邮件标题
$m->setMessageFromString(NULL, '<b>This is the message body.<b><br/><font color="red">gyj</font>');
//内容
//设置标题和内容编码
$m->setSubjectCharset('UTF-8');
$m->setMessageCharset('UTF-8');
//print_r($ses->sendEmail($m)); //发送邮件结果
print_r($ses->getSendQuota());
//摘要统计
print_r($ses->getSendStatistics());
//发送统计
//发邮件 base 64编码,针对中文
function address_encode($str)
{
    return '=?UTF-8?B?' . base64_encode($str) . '?=';
Ejemplo n.º 22
0
 function sendWelcomeRegistrationMail($register, $broker_id = "", $token = '', $userId = '')
 {
     $this->load->model('UserModel');
     $this->load->model('NewsLetterModel');
     $this->load->model('RoleModel');
     $this->load->library('parser');
     if ($register == "") {
         return false;
     }
     $user_details = $this->UserModel->getUserByEmail($register);
     $role_details = $this->RoleModel->getRoleWithEmail($register);
     $register_role = $role_details->label;
     $register_name = $user_details->first_name . ' ' . $user_details->middle_initial . ' ' . $user_details->last_name;
     $subject = 'Welcome to The Credit University';
     if ($broker_id) {
         $user = $this->UserModel->getUserByUserId($broker_id);
         $broker = $user->first_name . ' ' . $user->middle_initial . ' ' . $user->last_name;
     }
     $this->load->library('SimpleEmailService');
     $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
     $ses->enableVerifyPeer(false);
     $simpleEmailServiceMessage = new SimpleEmailServiceMessage();
     $sent = "";
     if (!empty($user->email)) {
         $simpleEmailServiceMessage->addTo($user->email);
         $simpleEmailServiceMessage->setFrom('The Credit University' . '<' . EMAILSENDER . '>');
         $simpleEmailServiceMessage->setSubject($subject);
         $today = date('Y-m-d');
         $data1 = array('subject' => 'Registered to The Credit University', 'date' => $today, 'registered' => $register, 'register_name' => $register_name, 'role' => $register_role, 'under_registered' => $broker);
         $code = $this->NewsLetterModel->getWelcomeLetterByShortCode(BROKER_WELCOME_TEMPLATE);
         if ($code != "") {
             $code = $this->parseTemplate($code, $data1);
             $simpleEmailServiceMessage->setMessageFromString('', $code);
             $sent = $ses->sendEmail($simpleEmailServiceMessage);
         }
     }
     $simpleEmailServiceMessage->addTo($register);
     $simpleEmailServiceMessage->setFrom('The Credit University' . '<' . EMAILSENDER . '>');
     $simpleEmailServiceMessage->setSubject($subject);
     $today = date('Y-m-d');
     $data = array('subject' => 'Registered to The Credit University', 'register_name' => $register_name, 'date' => $today, 'registered' => $register, 'role' => $register_role, 'under_registered' => $broker, 'token' => $token, 'user_id' => $userId);
     $code_register = $this->NewsLetterModel->getWelcomeLetterByShortCode(WELCOME_TEMPLATE);
     if ($code_register != "") {
         $code_register = $this->parseTemplate($code_register, $data);
         $simpleEmailServiceMessage->setMessageFromString('', $code_register);
         $sent = $ses->sendEmail($simpleEmailServiceMessage);
     }
     return $sent;
 }
Ejemplo n.º 23
0
\t\t
If you have any further questions, please feel free to contact me. Thanks and have a nice day^-^
\t\t
Best Regards,
\t\t
<span style='font-weight:bold;'>{$customer_s}</span></pre>
EOF;
        $ses = new SimpleEmailService('AKIAIU65Y4DAUM55JPMQ', '65cJ2xXwGO40w/Qs6nOyZV7j9d855019HhGuzn34');
        $message = new SimpleEmailServiceMessage();
        //$message->addTo('*****@*****.**'); 			       		 //收件人
        $message->addTo($buyermail);
        //收件人
        $message->setFrom($gmail);
        //发件人
        //print_r($ses->listVerifiedEmailAddresses());
        $message->setSubject('Message from Aliexpress Store: ' . $seller);
        // 邮件标题
        $message->setMessageFromString(NULL, $text);
        //内容
        //设置标题和内容编码
        $message->setSubjectCharset('UTF-8');
        $message->setMessageCharset('UTF-8');
        try {
            if ($ses->sendEmail($message)) {
                echo '发送成功' . "\n";
                $aliMark_obj->insertOKMail($seller, mysql_escape_string($buyer), $gmail, mysql_escape_string($buyermail), time(), mysql_escape_string($text));
            } else {
                echo '发送失败1' . "\n";
            }
            unset($aliMark_obj);
        } catch (Exception $e) {
Ejemplo n.º 24
0
 function supportEmail()
 {
     $clientOwner = array('Client', 'Owner');
     $result = array_intersect($clientOwner, $this->session->userdata(ROLES));
     if ($result) {
         $brokerId = $this->UserModel->getBrokerFromClientid($this->session->userdata(USER_ID));
         $brokerIdArray = array($brokerId);
         $brokerEmail[] = $this->UserModel->getEmailAddress($brokerId);
     }
     $adminUsers = $this->UserModel->getAdminUsers();
     foreach ($adminUsers as $userAdmin) {
         $receiverAdminId[] = $userAdmin->id;
         $receiverAdminEmail[] = $userAdmin->email;
     }
     if ($brokerIdArray) {
         $receiverId = array_unique(array_merge($receiverAdminId, $brokerIdArray));
         $receiverEmail = array_unique(array_merge($receiverAdminEmail, $brokerEmail));
     } else {
         $receiverId = $receiverAdminId;
         $receiverEmail = $receiverAdminEmail;
     }
     $emailId = $this->EmailModel->insertEmails('Success', $receiverId);
     $link = '<a href="' . base_url(ADMIN_PATH . "mail/read_mail/" . $emailId) . '" target="_blank">here</a>';
     $emailMessage = "You've received email from " . $this->session->userdata(NAME) . ". Click " . $link . " to view the message.";
     $subject = $this->input->post('subject');
     $message = $emailMessage;
     $this->load->library('SimpleEmailService');
     $ses = new SimpleEmailService('AKIAISEC5PBG2F54VL4A', 'ZhRYSpKdUMLRrxPwy878UN+pJmnllAocdcYRpJwZ');
     $ses->enableVerifyPeer(false);
     $m = new SimpleEmailServiceMessage();
     $m->addTo(EMAILSENDER);
     $m->addCC($receiverEmail);
     $m->setFrom($this->name . ' via Credit University' . '<' . EMAILSENDER . '>');
     $m->setSubject($subject);
     $msg = $message;
     $m->setMessageFromString('', $msg);
     $ses->sendEmail($m);
     $this->session->set_flashdata("supportMessage", "Support & Suggestion email has been sent successfully.");
     redirect(ADMIN_PATH);
 }
Ejemplo n.º 25
0
function send_webmail_byses($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '')
{
    global $log, $access_key, $secret_key;
    $log->debug("Entering send_webmail_byses() method ...");
    require_once 'include/ses.php';
    $errMsg = "";
    if ($access_key != "" && $secret_key != "") {
        $ses = new SimpleEmailService($access_key, $secret_key);
        if (!isset($_SESSION["MAILLIST_PLAINTEXT"])) {
            $headertag = "<HEAD><META http-equiv=\"Content-Type\" content=\"text/html; charset=GBK\"></HEAD>";
            $contents = from_html($contents);
            $contents = eregi_replace('<BODY', $headertag . '<BODY', $contents);
        }
        $m = new SimpleEmailServiceMessage();
        $m->addTo($to_email);
        $m->setFrom($from_email);
        $m->setSubject($subject);
        $m->setMessageFromString($contents);
        $m->setSubjectCharset('GBK');
        $m->setMessageCharset('GBK');
        $errMsg = $ses->sendEmail($m);
        $log->debug("send_webmail_byses sendEmail result:" . $errMsg);
    }
    $log->debug("Exit send_webmail_byses() method ...");
    return $errMsg;
}
Ejemplo n.º 26
0
function wpses_mail($to, $subject, $message, $headers = '')
{
    global $SES;
    global $wpses_options;
    wpses_check_SES();
    $html = $message;
    $txt = strip_tags($html);
    if (strlen($html) == strlen($txt)) {
        $html = '';
        // que msg text
    }
    // TODO: option pour que TXT si msg html, ou les deux comme ici par défaut.
    $m = new SimpleEmailServiceMessage();
    $m->addTo($to);
    $m->setFrom('"' . $wpses_options['from_name'] . '" <' . $wpses_options['from_email'] . ">");
    $m->setReturnPath($wpses_options['return_path']);
    $m->setSubject($subject);
    if ($html == '') {
        // que texte
        $m->setMessageFromString($message);
    } else {
        $m->setMessageFromString($txt, $html);
    }
    $res = $SES->sendEmail($m);
    if (is_array($res)) {
        return $res['MessageId'];
    } else {
        return NULL;
    }
}
Ejemplo n.º 27
0
			</td>
			<td style="text-align: center; vertical-align: top; ">
				<strong><span style="font-size: 12px; color: rgb(0, 100, 0);"><span style="font-family: arial, helvetica, sans-serif; "><a href="http://www.xebura.com"><img src="http://s1.xebura.com/logo.gif?i=' . $eid . '&s=' . $cid . '" border="0"/></a><br />
				Sent with Xebura</span></span></strong></td>
		</tr>
	</tbody>
</table>
</body>
</html>';
                $final_subject = str_replace('{LNAME}', $lname, $subject);
                $m = new SimpleEmailServiceMessage();
                $m->addTo($email);
                $m->setFrom($from_label . " <" . $from_email . ">");
                //$m->setReturnPath($eid."_".$cid."*****@*****.**");
                //$m->setReturnPath('*****@*****.**');
                $m->setSubject($final_subject);
                $m->setMessageFromString('text' . $msg_txt, $html);
                $ses->sendEmail($m);
                $send_count++;
            }
        }
        ////update job as completed
        $end_time = date('Y-m-d G:i:s', strtotime("now"));
        //// update message job as completed
        $values = array(XE_JOB_STATUS => '5', XE_JOB_SEND_COUNT => $send_count, XE_JOB_ENDED_TIME => $end_time);
        //status 5 = finished
        $db->update("XEBURA_JOBS", $values, "WHERE XE_JOB_ID = '" . $jid . "'");
        //$values = array(XE_GROUP_LAST_LAUNCH_DATE => $end_time);
        $db->query("UPDATE XEBURA_EMAIL_GROUP SET XE_GROUP_LAST_LAUNCH_DATE = '" . $end_time . "' WHERE XE_ADDRESS_GROUP_ID IN(" . $gid . ")");
    }
}
Ejemplo n.º 28
0
             $inserttoCustom['contact_subscriber_id'] = $subscriber_id;
             $inserttoCustom['custom_field_id'] = $custVal['customfield_id'];
             $inserttoCustom['custom_field_value'] = $custVal['form_custom_field_value'];
             $insertID = $dbClass->prepareInsertStatement("subscribe_custom_fields", $inserttoCustom);
         }
     }
 }
 $dispthnk = '1';
 $thankupageDet = $dbClass->getTableRecordSingle("form_page", "form_id=? and page_type=?", array($formId, 'thankyou'));
 $subscription_EmailId = $emailId;
 if ($thankupageDet['send_from_name'] != "") {
     $mail->setFrom($thankupageDet['send_from_name'] . "<*****@*****.**>");
 } else {
     $mail->setFrom("*****@*****.**");
 }
 $mail->setSubject(stripslashes($thankupageDet['email_subject']));
 $campaign_text_body = stripslashes($thankupageDet['email_text']);
 $campaign_html_body = stripslashes($thankupageDet['email_html']);
 if ($form_format == 'ft') {
     $body = $campaign_text_body;
 } else {
     $body = $campaign_html_body;
     $text_body = $campaign_text_body;
 }
 //echo $body;exit;
 //echo $subscription_EmailId;
 $mail->setMessageFromString($text_body, $body);
 $mail->addTo($subscription_EmailId);
 $mail->addReplyTo("*****@*****.**");
 $mail->setReturnPath("*****@*****.**");
 $sendArray = "";