/** * Updates the cart contents. */ function onAction() { global $application; $request = $application->getInstance('Request'); if (!modApiFunc('Customer_Account', 'getCurrentSignedCustomer')) { return; } $email = trim($request->getValueByKey('wl_send_email')); $validator =& $application->getInstance('CAValidator'); if ($validator->isValid('email', $email)) { loadCoreFile('ascHtmlMimeMail.php'); $mail = new ascHtmlMimeMail(); $mail->setText(cutTemplatesPathes(getSendWishlistContent())); $mail->setSubject(getMsg('CZ', 'WL_SEND_WISHLIST_SUBJECT')); $mail->setFrom(modApiFunc('Notifications', 'getExtendedEmail', '', 'EMAIL_STORE_OWNER', true)); $mail->send(array($email)); modApiFunc('Session', 'set', 'WishlistResultMessage', getMsg('CZ', 'WL_WISHLIST_SENT')); } else { modApiFunc('Session', 'set', 'WishlistErrorMessage', getMsg('CZ', 'WL_INCORRECT_EMAIL_SPECIFIED')); } $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $application->redirect($request); }
/** * Sends a report to each of the recipient. */ function asc_send($subj, $body, $to_address) { loadCoreFile('ascHtmlMimeMail.php'); $mail = new ascHtmlMimeMail(); $mail->setText($body); $mail->setSubject($subj); $mail->setFrom($to_address); $mail->send(array($to_address)); }
/** * Prepares a letter to a user about changing his password. * * @ paste e-mail addresses from config */ function letterAboutNewPassword($email, $password) { $email_text = modApiFunc('TmplFiller', 'fill', "./../letters/", "new_admin_password.tpl.txt", array("Email" => $email, "Password" => $password)); $email_subj = modApiFunc('TmplFiller', 'fill', "./../letters/", "new_admin_password_subj.tpl.txt", array()); loadCoreFile('ascHtmlMimeMail.php'); $mail = new ascHtmlMimeMail(); $mail->setText($email_text); $mail->setSubject($email_subj); $from_email = modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_OWNER_EMAIL); if (!$this->isValidEmail($from_email)) { $admin_info = $this->getAcountInfoById(1); $from_email = isset($admin_info[0]["email"]) ? $admin_info[0]["email"] : ""; if (!$this->isValidEmail($from_email)) { $from_email = "Avactis Shopping Cart Software"; } } $from = $from_email; $mail->setFrom($from); return $mail->send(array($email)); }
function SendMailToAdmin() { $value = ""; $Nvalue = ""; $Mod = modApiFunc('SecureStore', 'checkSessionForModifiedFile'); $New = modApiFunc('SecureStore', 'checkSessionForNewlyAddedFile'); $Msg = getMsg('SS', 'FIND_UPDATE_NO_RESULT_MSG'); $NewA = getMsg('SS', 'NEWLY_ADDED_FILE'); $NewM = getMsg('SS', 'MODIFIED_FILE'); if ($Mod !== $Msg) { $value = $NewM . "<br/><br/>" . $Mod; } if ($New !== $Msg) { $Nvalue = "<br/><br/>" . $NewA . "<br/><br/>" . $New; } if ($value !== "" || $Nvalue !== "") { $Mail_Body = $value . $Nvalue; $email = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_OWNER_SITE_ADMINISTRATOR_EMAIL); loadCoreFile('ascHtmlMimeMail.php'); $mail = new ascHtmlMimeMail(); $mail->setText($Mail_Body); $mail->setSubject(getMsg('SS', 'SS_SEND_FILES_DETAILS_SUBJECT')); $mail->setFrom(modApiFunc('Notifications', 'getExtendedEmail', $email, 'EMAIL_STORE_OWNER', true)); $mail->send(array($email)); if (!$mail->send(array($email))) { CTrace::wrn('Mailer error: ' . $mail->ErrorInfo); } else { CTrace::inf('Mail has been sent for file changes in last days'); } $tl_type = getMsg('NTFCTN', 'NTFCTN_TL_TYPE'); $to = $email; $subj = getMsg('SS', 'SS_SEND_FILES_DETAILS_SUBJECT'); $tl_header = getMsg('SS', 'SS_SEND_FILES_DETAILS_SUBJECT'); $tl_body = $Mail_Body; modApiFunc('Timeline', 'addLog', $tl_type, $tl_header, $tl_body); $Msg = getMsg('SS', 'MAIL_SENT'); modApiFunc('Session', 'set', 'MailSendResultMessage', $Msg); } else { $Msg = getMsg('SS', 'ERROR_TO_SEND_MAIL'); modApiFunc('Session', 'set', 'MailSendResultMessage', $Msg); } modApiFunc('Session', 'set', 'ModifiedFileResult', ""); modApiFunc('Session', 'set', 'NewlyAddedFileResult', ""); }
/** * @ */ function onAction() { global $application; $request = $application->getInstance('Request'); $subaction = $request->getValueByKey("asc_subaction"); if ($subaction != 'update' && $subaction != 'send') { $subaction = 'update'; } if ($subaction == 'update') { $messages["ERRORS"] = array(); $messages["MESSAGES"] = array(); $type = intval($request->getValueByKey("mail_type_select")); $host = trim($request->getValueByKey("mail_host")); $port = trim($request->getValueByKey("mail_port")); $auth = $request->getValueByKey("mail_auth"); $user = trim($request->getValueByKey("mail_user")); $pass = trim($request->getValueByKey("mail_pass")); $SessionPost = $_POST; if ($type == 2) { if (_ml_strlen($host) == 0) { $messages["ERRORS"][] = 'MAIL_SETTINGS_WARNING_HOST'; } if (_ml_strlen($port) == 0) { $messages["ERRORS"][] = 'MAIL_SETTINGS_WARNING_PORT'; } if ($auth == "on") { if (_ml_strlen($user) == 0) { $messages["ERRORS"][] = 'MAIL_SETTINGS_WARNING_USER'; } if (_ml_strlen($pass) == 0) { $messages["ERRORS"][] = 'MAIL_SETTINGS_WARNING_PASS'; } } } if (sizeof($messages["ERRORS"])) { modApiFunc('Session', 'set', 'ResultMessage', $messages); } else { $values = array("MAIL_TYPE" => $type, "MAIL_HOST" => $host, "MAIL_PORT" => $port, "MAIL_AUTH" => $auth == "on" ? 1 : 0, "MAIL_USER" => $user, "MAIL_PASS" => $pass); modApiFunc('Configuration', 'setMailSettings', $values); $messages["MESSAGES"][] = 'MSG_MAIL_SETTINGS_UPDATED'; modApiFunc('Session', 'set', 'ResultMessage', $messages); } } else { $body = modApiFunc("Configuration", "getMailSettings"); if ($body["MAIL_TYPE"] == 1) { $body = array("MAIL_TYPE" => getMsg("SYS", "MAIL_SETTINGS_SERVER_DEFAULTS")); } else { $body["MAIL_TYPE"] = getMsg("SYS", "MAIL_SETTINGS_SPECIFIC_SETTINGS"); if ($body["MAIL_AUTH"] == 0) { $body["MAIL_AUTH"] = "No"; unset($body["MAIL_USER"]); unset($body["MAIL_PASS"]); } else { $body["MAIL_AUTH"] = "Yes"; } } $from_address = modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_OWNER_SITE_ADMINISTRATOR_EMAIL); $subject = getMsg("SYS", "MAIL_SETTINGS_AVACTIS_TEST_MAIL_SUBJECT"); $body = getMsg("SYS", "MAIL_SETTINGS_AVACTIS_TEST_MAIL_BODY") . "\n\n" . print_r($body, true); loadCoreFile('ascHtmlMimeMail.php'); $mail = new ascHtmlMimeMail(); $mail->setText($body); $mail->setSubject($subject); $mail->setFrom($from_address); $to = trim($request->getValueByKey("mail_subject")); $rlt = $mail->send(array($to)); if ($rlt) { $messages["MESSAGES"][] = 'MSG_MAIL_SENT'; } else { $messages["ERRORS"][] = 'MAIL_NOT_SENT'; } modApiFunc('Session', 'set', 'ResultMessage', $messages); } $request = new Request(); $request->setView(CURRENT_REQUEST_URL); $application->redirect($request); }
/** * . PORTION_MAX_EXPORT_TIME . */ function sendMessagesPortion() { global $application; loadCoreFile('ascHtmlMimeMail.php'); $mailer = new ascHtmlMimeMail(); $from = $this->_currentMessage['letter_from_name'] . ' <' . $this->_currentMessage['letter_from_email'] . '>'; $mailer->setFrom($from); $mailer->setSubject($this->_currentMessage['letter_subject']); $html = "<html><head><title>{$this->_currentMessage['letter_subject']}</title></head><body>{$this->_currentMessage['letter_html']}</body></html>"; $mailer->setHtml($html); $start_time = $this->microtime_float(); $sent_count = 0; // // $max_to_send // $table = 'newsletter_temp'; $tables = $this->getTables(); // PORTION_MAX_MESSAGES_NUM , (_sentCountTotal + 1) // , PORTION_MAX_MESSAGES_NUM $query = new DB_Select(); $query->addSelectTable($table); $query->addSelectField($tables[$table]['columns']['recipient_value']); $query->addWhereOpenSection(); $query->WhereValue($tables[$table]['columns']['recipient_num'], DB_GTE, $this->_sentCountTotal + 1); $query->WhereAND(); $query->WhereValue($tables[$table]['columns']['recipient_num'], DB_LTE, $this->_sentCountTotal + PORTION_MAX_MESSAGES_NUM); $query->addWhereCloseSection(); $res = $application->db->getDB_Result($query); $addr_num = count($res); while ($this->microtime_float() - $start_time < PORTION_MAX_EXPORT_TIME && $sent_count < $addr_num) { // // // $mailer->send(array($res[$sent_count]['recipient_value'])); $sent_count++; // : /*debug*/ //usleep(200000); } $this->_sentCountTotal += $sent_count; $sending_status = 'PROCESSING'; if ($this->_sentCountTotal >= $this->_totalRecipients) { $this->_sentCountTotal = $this->_totalRecipients; // // // $table = 'newsletter_temp'; $tables = $this->getTables(); $query = new DB_Delete($table); $application->db->PrepareSQL($query); $application->db->DB_Exec(); $this->updateMessage($this->_currentMessage['letter_id'], array('letter_sent_date' => date('Y-m-d G:i:s'))); $sending_status = 'COMPLETED'; } return array('errors' => '', 'warnings' => '', 'sent_total' => $this->_sentCountTotal, 'sending_status' => $sending_status); }
/** * Sends a notification to each of the receiver. */ function send() { loadCoreFile('ascHtmlMimeMail.php'); if (!$this->haveToSend) { return; } if (Configuration::getSupportMode(ASC_S_NOTIFICATIONS)) { return; } // getting the recipients and languages $to = $this->getMLSendTo(); // adding third party emails to "To" array if (isset($this->thirdparty_emails) && is_array($this->thirdparty_emails) && !empty($this->thirdparty_emails)) { foreach ($this->thirdparty_emails as $i => $email) { $to[] = $email; } } // saving the current languages $cur_lng = modApiFunc('MultiLang', 'getLanguage'); $cur_res_lng = modApiFunc('MultiLang', 'getResourceLanguage'); // processing the recipients foreach ($to as $address) { // skipping invalid records (paranoidal check) if (!isset($address[0]) || !$address[0]) { continue; } // setting the language for the current notification modApiFunc('MultiLang', 'setLanguage', @$address[1]); modApiFunc('MultiLang', 'setResourceLanguage', @$address[1]); $format = modApiFunc('Settings', 'getParamValue', 'EMAIL_NOTIFICATION_SETTINGS', 'EMAIL_NOTIFICATION_FORMAT'); $this->prepareEmailTextAndSubject(); // there were some problems with Unix <-> Windows linefeeds // so we make it all Windows style $this->EmailText = str_replace("\n", "\r\n", str_replace("\r\n", "\n", $this->EmailText)); $mail = new ascHtmlMimeMail(); if ($format == "HTML") { $mail->setHtml($this->EmailText); } else { $mail->setText($this->EmailText); } $mail->setSubject($this->EmailSubject); $from = $this->getSendFrom(); $mail->setFrom($from); // $mail->setCc($from); $this->addEmailToTimeline($address[0], $mail->send(array($address[0])), @$address[1]); } // restoting the languages modApiFunc('MultiLang', 'setLanguage', $cur_lng); modApiFunc('MultiLang', 'setResourceLanguage', $cur_res_lng); }