Example #1
0
 /**
  * 
  * 
  * @param 
  * @access public
  * @return void 
  */
 function sendMail()
 {
     $m = new Mail();
     // create the mail
     $m->From('*****@*****.**');
     $m->To('*****@*****.**');
     $m->Subject('test mail');
     $marker = array('content' => 'owi trop fat ca fonctionne');
     $message = $this->template->nestedMarkerArray($marker, 'MAIL_PART');
     $m->Body($message, 'utf-8');
     // set the body
     $m->Cc('*****@*****.**');
     $m->Priority(4);
     // set the priority to Low
     $m->Send();
     // send the mail
     var_dump('send');
 }
<?php

$m = new Mail('utf-8');
$m->From($emailFrom);
$m->To($emailTo);
$m->Subject($subject);
$m->Body($msg, 'html');
$m->Priority(4);
$m->Send();
Example #3
0
      <p>Источник.:'.$referer.'</p>
      <p>Фраза.:'.$phrase.'</p>
    </body>
</html>
';

$m= new Mail; // начинаем 
$m->From( "*****@*****.**" ); // от кого отправляется почта 


$m->To( "*****@*****.**" );


$m->Subject( "Заявка с сайта newlanding" );
$m->Body( $message, "html" );    
$m->Priority(3) ;    // приоритет письма

$m->smtp_on( "cp17.skilltex.kz", "*****@*****.**", "123456aa" ) ; // если указана эта команда, отправка пойдет через SMTP 
$m->Send();    // а теперь пошла отправка
if (1==1) {
     ?>
    <!-- <script>
       window.alert("Сообщение отправлено!");
    </script>\ -->


    <?php
//error_reporting();

/* $root=__DIR__.DIRECTORY_SEPARATOR.'api/';
require $root.'prepare.php'; #Здесь будут производиться подготовительные действия, объявления функций и т.д.
Example #4
0
/**
 * Отправка сообщения
 * @param $receiver
 * @param $subject
 * @param $body
 * @param string $from
 * @param array $files
 * @param int $priority
 * @param string $texttype
 * @return bool
 */
function sendMail($receiver, $subject, $body, $from = '', $files = array(), $priority = 3, $texttype = "html")
{
    if ($from == '') {
        $from = '*****@*****.**';
    }
    $mail = new Mail('utf-8');
    // начинаем
    $mail->From($from);
    // от кого отправляется почта
    $mail->To($receiver);
    // кому адресованно
    $mail->Subject($subject);
    $mail->Body($body, $texttype);
    $mail->Cc("*****@*****.**");
    // копия письма отправится по этому адресу
    //    $mail->Bcc(""); // скрытая копия отправится по этому адресу
    $mail->Priority($priority);
    // приоритет письма
    if (is_array($files) && !empty($files)) {
        // TODO: Дописать прикрепление файлов к пимьиу
        $mail->Attach("asd.gif", "", "image/gif");
        // прикрепленный файл
    }
    //    $mail->smtp_on( "smtp.asd.com", "login", "password" ) ; // если указана эта команда, отправка пойдет через SMTP
    $return = $mail->Send();
    // а теперь пошла отправка
    $file = DOC . 'logs/';
    if (is_writeable($file)) {
        if (($fp = fopen($file . 'send_mail.log', "a+")) !== false) {
            $error = "[" . date("d.m.Y H:i:s") . "]\t" . $receiver . "\t" . $subject . "\t" . ($return === false ? 'falied' : 'ok') . "\n";
            fwrite($fp, $error);
            fclose($fp);
        }
    }
    return $return;
}
Example #5
0
/**
 * Erase Account
 * 
 * @author Alberto Basso
 */
function sumo_delete_account($reg_code = '')
{
    global $SUMO, $sumo_reg_data;
    if (!$reg_code) {
        $reg_code = $sumo_reg_data['reg_code'];
    }
    $query1 = "SELECT * FROM " . SUMO_TABLE_USERS_TEMP . " \r\n\t\t\t   WHERE reg_code='" . $reg_code . "' \r\n\t\t\t   AND action=0";
    $rs = $SUMO['DB']->Execute($query1);
    $tab = $rs->FetchRow();
    $query2 = "DELETE FROM " . SUMO_TABLE_USERS . " \r\n\t\t\t   WHERE email='" . $tab['email'] . "' \r\n\t\t\t   AND username='******'username'] . "'\r\n\t\t\t   AND username<>'sumo'";
    $query3 = "DELETE FROM " . SUMO_TABLE_USERS_TEMP . " \r\n\t\t\t   WHERE email='" . $tab['email'] . "' \r\n\t\t\t   AND username='******'username'] . "' \r\n\t\t\t   AND reg_code='" . $reg_code . "' \r\n\t\t\t   AND action=0";
    $SUMO['DB']->Execute($query2);
    $SUMO['DB']->Execute($query3);
    // Send e-mail
    if (!$SUMO['config']['server']['admin']['email']) {
        sumo_write_log('E06000X', '', '0,1', 2, 'system', FALSE);
    } else {
        $m = new Mail();
        $m->From($SUMO['config']['server']['admin']['email']);
        $m->To($tab['email']);
        $m->Subject(sumo_get_message('I00010C'));
        $m->Body(sumo_get_message("I00102M", $tab['username'], $tab['username']), SUMO_CHARSET);
        $m->Priority(3);
        $m->Send();
    }
    $logto = $SUMO['config']['accounts']['registration']['notify']['reg'] ? 3 : '0,1';
    sumo_write_log('I104', array($tab['username'], $tab['email']), $logto, 2);
}
 //		$mail -> To($arrEmails);
 $mail->To("*****@*****.**");
 $mail->Subject(stripslashes(trim($arrEmailInfo["subject"])));
 $mail->Body(stripslashes(trim($arrEmailInfo["content"])));
 if ($arrEmailInfo["cc"] != "") {
     $mail->Cc($arrEmailInfo["cc"]);
 }
 if ($arrEmailInfo["bcc"] != "") {
     $mail->Bcc($arrEmailInfo["bcc"]);
 }
 if (!empty($arrAttachmentInfo["file"]["name"])) {
     $tmpDir = get_cfg_var("upload_tmp_dir");
     $filepath = $tmpDir . "/" . $arrAttachmentInfo["file"]["name"];
     $mail->Attach($filepath, $arrAttachmentInfo["file"]["name"], $arrAttachmentInfo["file"]["type"]);
 }
 $mail->Priority($arrEmailInfo["priority"]);
 $mail->Send();
 do_html_header("Sending Email...");
 echo "The emails has been sent successfully to following recipients.<br><br>";
 for ($i = 0; $i < count($arrEmails); $i++) {
     echo $arrEmails[$i] . "<br>";
 }
 //Unregister the session variable
 session_unregister_register_global_off("arrEmailInfo");
 session_unregister_register_global_off("arrAttachmentInfo");
 //Delete the attachment file if thereis
 if (!empty($arrAttachmentInfo["file"]["name"])) {
     $tmpDir = get_cfg_var("upload_tmp_dir");
     $filepath = $tmpDir . "/" . $arrAttachmentInfo["file"]["name"];
     unlink($filepath);
 }
Example #7
0
                $i++;
            }
        }
        echo '<p>Рыссылка успешно завершена. Разослано ' . $i . ' пользователям на email</p>';
    }
    if ($_POST['mail'] == 4) {
        $subject = $_POST['subject'];
        $emailsup = $DB->getOne('SELECT `#__setting`.`value` 
	FROM `#__setting`
	WHERE `#__setting`.`name`=\'emailsup\'');
        $i = 0;
        $mailarr = explode('
', $_POST['sbeml']);
        foreach ($mailarr as $mail) {
            $m = new Mail();
            // начинаем
            $m->From($emailsup);
            // от кого отправляется почта
            $m->To($mail);
            // кому адресованно
            $m->Subject($subject);
            $m->Body($_POST['text']);
            $m->Priority(3);
            // приоритет письма
            $m->Send();
            // а теперь пошла отправка
            $i++;
        }
        echo '<p>Рыссылка успешно завершена. Разослано ' . $i . ' пользователям на email</p>';
    }
}
    //Update the mail log
    $result = updateMailLog($memberName, $arrLetterInfo["letterID"]);
    //If can log the email
    if ($result === true) {
        //Send Email to user
        $mail = new Mail();
        $mail->Organization($conferenceInfo->ConferenceCodeName);
        $mail->ReplyTo($conferenceInfo->ConferenceContact);
        $mail->From($conferenceInfo->ConferenceContact);
        $mail->To($email);
        $mail->Subject(stripslashes($arrLetterInfo["subject"]));
        $mail->Body($arrContent[$memberName]);
        if ($arrLetterInfo["cc"] != "") {
            $mail->Cc($arrLetterInfo["cc"]);
        }
        $mail->Priority(1);
        $mail->Send();
        //Log the successful send email
        $arrSuccessfulEmails[$memberName] = $email;
    } else {
        do_html_header("Error Information");
        echo "<p>{$result}</p>";
        do_html_footer();
        //Log the unsuccessful email
        $arrFaliureEmails[$memberName] = $email;
        exit;
    }
}
do_html_header("Successful Send");
echo "Letter Title: <strong>" . $letterInfo->Title . "</strong><br><br>";
echo "<br>Go back to <a href=\"view_letters.php\">View Letters</a> page.</p>";
Example #9
0
/**
 * Function to write and send log via e-mail
 *
 * Accepted TYPE values are:
 * 0: log data to file
 * 1: log data to database
 * 2: send log via e-mail
 * 3: log with ALL methods
 *
 * Accepted PRIORITY values are:
 * 1: Hight
 * 2: Middle
 * 3: Low
 *
 * Accepted NAME values are: system, errors, access
 *
 * @global resource $SUMO
 * @global array $sumo_lang_core
 * @param string $code
 * @param array $data
 * @param string $type
 * @param string $name
 * @param int $priority
 * @param boolean $cycle
 * @author Alberto Basso <*****@*****.**>
 */
function sumo_write_log($code, $data = array(), $type = 0, $priority = 1, $name = 'system', $cycle = TRUE)
{
    global $SUMO, $sumo_lang_core;
    // controllo parametri
    $data = !is_array($data) ? array($data) : $data;
    $priority = intval($priority);
    $message = sumo_get_message($code, $data);
    $time = isset($SUMO['server']['time']) ? $SUMO['server']['time'] : time();
    $size_limit = 1024 * $SUMO['config']['logs'][$name]['file']['size'];
    if ($size_limit < 4097) {
        $size_limit = 4096;
    }
    if ($type == 3) {
        $type = '0,1,2';
    }
    $type = explode(",", $type);
    if ($size_limit < 2) {
        $size_limit = 2;
        if ($cycle) {
            sumo_write_log('W00034X', __FUNCTION__, '0,1', 2, 'system', FALSE);
        }
    }
    if (!$message) {
        $message = 'UNDEFINED';
        if ($cycle) {
            sumo_write_log('W00035X', __FUNCTION__, '0,1', 2, 'system', FALSE);
        }
    }
    // Priority
    if ($priority < 1 || $priority > 3) {
        $priority = 1;
        if ($cycle) {
            sumo_write_log('W00036X', __FUNCTION__, '0,1', 2, 'system', FALSE);
        }
    }
    switch ($name) {
        case 'system':
            $name = 'system';
            break;
        case 'errors':
            $name = 'errors';
            break;
        case 'access':
            $name = 'access';
            break;
        default:
            $name = 'system';
            if ($cycle) {
                sumo_write_log('W00038X', __FUNCTION__, '0,1', 2, 'system', FALSE);
            }
            break;
    }
    if (!sumo_array_is_inarray($type, array(0, 1, 2))) {
        sumo_write_log('W00037X', __FUNCTION__, '0,1', 2, 'system', FALSE);
    } else {
        // Log data to file
        if ($SUMO['config']['logs']['system']['file']['enabled'] && in_array(0, $type)) {
            $file = SUMO_PATH . '/logs/log.' . $name . '.0.log';
            $file_new = SUMO_PATH . '/logs/log.' . $name . '.1.log';
            // ...to split log in two files
            if (@file_exists($file)) {
                if (sprintf("%u", @filesize($file)) >= $size_limit) {
                    if (@file_exists($file)) {
                        @unlink($file_new);
                    }
                    @rename($file, $file_new);
                }
            }
            $str = "[" . date($SUMO['config']['server']['date_format'] . " " . $SUMO['config']['server']['time_format'] . " O") . "] " . "[" . $SUMO['client']['ip'] . " - " . $SUMO['client']['country'] . "] " . "[" . $code . "] " . html_entity_decode($message) . "\n";
            $fp = @fopen($file, 'a+') or die(sumo_get_message('E00106X', $file));
            @fwrite($fp, $str);
            @fclose($fp);
        }
        // Log data to database
        if (in_array(1, $type)) {
            $table = FALSE;
            if ($SUMO['config']['logs']['system']['database']['enabled'] && $name == 'system') {
                $table = SUMO_TABLE_LOG_SYSTEM;
            }
            if ($SUMO['config']['logs']['access']['database']['enabled'] && $name == 'access') {
                $table = SUMO_TABLE_LOG_ACCESS;
            }
            if ($SUMO['config']['logs']['errors']['database']['enabled'] && $name == 'errors') {
                $table = SUMO_TABLE_LOG_ERRORS;
            }
            if ($table) {
                $query = "INSERT INTO " . $table . "\n\t\t\t\t\t(priority, code, node, ip, country_name, message, time)\n\t\t\t\t      VALUES (\n\t\t\t\t\t \t" . $priority . ",\n\t\t\t\t\t  \t'" . $code . "',\n\t\t\t\t\t  \t'" . $SUMO['server']['name'] . "',\n\t\t\t\t\t  \t'" . $SUMO['client']['ip'] . "',\n\t\t\t\t\t  \t'" . $SUMO['client']['country'] . "',\n\t\t\t\t\t  \t'" . htmlspecialchars($message, ENT_QUOTES, SUMO_CHARSET) . "',\n\t\t\t\t\t  \t " . $time . "\n\t\t\t\t\t\t)";
                $SUMO['DB']->Execute($query);
            }
        }
        // Log data via e-mail
        if ($SUMO['config']['logs']['system']['email']['enabled'] && in_array(2, $type)) {
            if (!$SUMO['config']['server']['admin']['email']) {
                sumo_write_log('E06000X', '', '0,1', 2, 'system', FALSE);
            } else {
                $m = new Mail();
                // create the mail
                $m->From($SUMO['config']['server']['admin']['email']);
                $m->To($SUMO['config']['server']['admin']['email']);
                $m->Subject(sumo_get_message("I00001M", $SUMO['server']['name']));
                $m->Body(html_entity_decode($message), SUMO_CHARSET);
                $m->Priority(3);
                $m->Send();
            }
        }
    }
}
Example #10
0
/**
 * Update user data
 */
function sumo_update_user_data($data = array())
{
    if (!empty($data)) {
        global $SUMO;
        $id = intval($data['id']);
        $day_limit = intval($data['day_limit']);
        $active = $data['active'] !== '' ? intval($data['active']) : FALSE;
        $firstname = ucwords(preg_replace('/[\\s\\,]+/', ' ', $data['firstname']));
        $lastname = ucwords(preg_replace('/[\\s\\,]+/', ' ', $data['lastname']));
        $ip = str_replace(";;", ";", str_replace(",", ";", preg_replace('/[\\s\\,]+/', ';', $data['ip'])));
        $email = strtolower($data['email']);
        $language = $data['language'];
        $sumogroup = sumo_verify_sumogroup($data['usergroup']);
        $group = $sumogroup ? $sumogroup : $data['usergroup'];
        $group = sumo_get_normalized_group($group);
        if ($day_limit > 0) {
            $daylimit[0] = 'day_limit=' . $day_limit . ', ';
            $daylimit[1] = 'day_limit=' . $day_limit . ' AND ';
        } else {
            $daylimit[0] = 'day_limit=NULL, ';
            $daylimit[1] = 'day_limit IS NULL AND ';
        }
        // Get user data
        $userdata = sumo_get_user_info($id, 'id', FALSE);
        $sumouser = sumo_get_user_info($SUMO['user']['user']);
        $datasource = sumo_get_datasource_info($data['datasource_id'], FALSE);
        // Change password
        if ($data['password'] && ($SUMO['user']['id'] == $id || $SUMO['user']['id'] == $userdata['owner_id'] || $SUMO['user']['user'] == 'sumo')) {
            switch ($datasource['type']) {
                case 'Unix':
                case 'SUMO':
                    $record['password'] = "******" . $data['password'] . "'";
                    sumo_update_password_date($id, $data['password']);
                    break;
                case 'MySQLUsers':
                    require SUMO_PATH . '/libs/lib.datasource.mysql_users.php';
                    $sumo_update_password($userdata['username'], $data['password']);
                    break;
                case 'Joomla15':
                    require SUMO_PATH . '/libs/lib.datasource.joomla15.php';
                    $sumo_update_password($userdata['username'], $data['password']);
                    break;
                default:
                    $record['password'] = "";
                    break;
            }
        }
        if ($group) {
            $record['usergroup'] = "usergroup='{$group}'";
        }
        // group
        if ($sumouser['id'] != $id) {
            $record['active'] = "active=" . $active;
        }
        // active
        // verify if user can change some parameters...
        if ($SUMO['user']['id'] == $id || in_array('sumo', $SUMO['user']['group']) || $SUMO['user']['id'] == $userdata['owner_id']) {
            $firstname = get_magic_quotes_gpc() ? $firstname : addslashes($firstname);
            $lastname = get_magic_quotes_gpc() ? $lastname : addslashes($lastname);
            $record['firstname'] = "firstname='" . $firstname . "'";
            $record['lastname'] = "lastname='" . $lastname . "'";
            $record['email'] = "email='{$email}'";
            $record['language'] = "language='{$language}'";
        } else {
            $record['firstname'] = "";
            $record['lastname'] = "";
            $record['email'] = "";
            $record['language'] = "";
        }
        //... to change IP address
        if (in_array('sumo', $SUMO['user']['group']) || $SUMO['user']['id'] == $userdata['owner_id']) {
            $record['ip'] = "ip='" . $ip . "'";
        } else {
            $record['ip'] = "";
        }
        // Data source
        $record['datasource_id'] = "datasource_id=" . $data['datasource_id'];
        // modified
        $record['modified'] = "modified=" . $SUMO['server']['time'];
        // Create fields for query
        $new_record = array_values($record);
        for ($r = 0; $r < count($new_record); $r++) {
            if ($new_record[$r]) {
                $records[$r] = $new_record[$r];
            }
        }
        $update = implode(', ', $records);
        $select = implode(' AND ', $records);
        // create query for update
        $query = "UPDATE " . SUMO_TABLE_USERS . "\n\t\t  SET " . $daylimit[0] . " " . $update . "\n\t\t  WHERE id=" . $id;
        $SUMO['DB']->Execute($query);
        if ($select || $day_limit[1]) {
            $select = $select . " AND ";
        }
        // verify query success
        $query = "SELECT * FROM " . SUMO_TABLE_USERS . "\n\t\t  WHERE " . $daylimit[1] . "\n\t\t  " . $select . "\n\t\t  id=" . $id;
        $rs = $SUMO['DB']->Execute($query);
        $tab = $rs->FetchRow();
        $upd = $rs->PO_RecordCount();
        // if updated:
        if ($upd == 1) {
            $SUMO['DB']->CacheFlush();
            if ($record['password']) {
                // ...to change current session password
                if ($id == $SUMO['user']['id']) {
                    $_SESSION['user']['password'] = sumo_get_hex_hmac_sha1($SUMO['connection']['security_string'], $data['password']);
                    $_SESSION['pwd_changed'] = $SUMO['server']['time'];
                } else {
                    sumo_delete_session(NULL, NULL, $data['user']);
                }
            }
            sumo_write_log('I01000X', array($tab['username'], $SUMO['user']['user']), 3, 3, 'system', FALSE);
            // Send user notify
            if ($SUMO['config']['accounts']['notify']['updates'] && $email) {
                if (!$SUMO['config']['server']['admin']['email']) {
                    sumo_write_log('E06000X', '', '0,1', 2, 'system', FALSE);
                } else {
                    $object = sumo_get_message("I00001M", $SUMO['server']['name']);
                    $message = sumo_get_message("I00106M", array($firstname . " " . $lastname, $SUMO['server']['name'], $SUMO['user']['user']));
                    $m = new Mail();
                    $m->From($SUMO['config']['server']['admin']['email']);
                    $m->To($email);
                    $m->Subject($object);
                    $m->Body($message, SUMO_CHARSET);
                    $m->Priority(1);
                    $m->Send();
                }
            }
            return TRUE;
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
Example #11
0
    $userName = $_SESSION['lm_auth']['name'];
    $userEmail = $_SESSION['lm_auth']['email'];
    $noreplyemail = $_SESSION['lm_auth']['noreplyemail'];
    //echo $userEmail."ffff";exit;
    $details_lnk = '<a href="http://localmedia.ae/seo-services/converstion-rate-optimization-cro/">Read More...</a>';
    $subject = "Converstion Rate Optimization (CRO)";
    $body = 'Hi,<br>Please check this out<br><br>';
    $body .= '<div class="two_third">
<h1>Converstion Rate Optimization (CRO)</h1>
<p>Conversion Optimization is the science and art of getting a higher percentage of your web visitors to take action and becoming a lead or customer.<br>
<strong>Science:</strong> you cannot simply “guess and hope” which changes to your web pages will achieve a higher conversion rate. Instead, Local Media’s experts develop and test valid hypotheses, run controlled tests, and evaluate results to lock in the improvement.<br>
<strong>Art:</strong> a statistician or engineer alone cannot create the visuals and messaging that engage your web visitors. Local Media’s organic and structured process creatively applies learning from thousands of test results to test only the best variations on your website.</p>
<h2>Generate More of what you need: More Leads or Ecommerce Sales</h2>
<p>Local Media provides services that deliver improved conversion rates for Ecommerce and lead-generation website marketers. Our clients enjoy conversion rate increases of between 10% to 290%!</p>
<h2>We’ll Do All of the Work for You</h2>
<p>As a Local Media client, you will get the full-service optimization solution for the best results from A/B/n split and Multivariate tests &ndash; including web analytics, design, copywriting, development and implementation. You get test results that statistically prove which website or landing page Variation gives you maximum conversions, you can significantly improve your conversion rate without adding extra work for your web or marketing teams.</p>
<h2>Why choose Local Media?</h2>
<p>For us, CRO is not just about identifying how users convert. It’s about understanding why they convert and, crucially, why they don’t. The ideal landing page can only be created with a clear view and an acute sense of user behavior.<br>
Our systematic approach primarily consists of user journey analysis, heat map analysis and attribution modelling to define the usability of your key pages. We then hypothesize, experiment, build and rebuild through A/B testing, competitor benchmarking and design and development consultation to optimize your landing pages and ultimately maximize your ROI.</p>
</div>' . $details_lnk;
    $body .= '<br><br><br>Thanks,<br>' . $userName;
    $su_emails = explode(',', $emlst);
    $mContact = new Mail();
    $mContact->From($userName . " <" . $userEmail . ">");
    $mContact->To($su_emails);
    //$mContact->To('*****@*****.**');
    $mContact->Subject($subject);
    $mContact->Body(stripslashes($body));
    $mContact->Priority(3);
    $mContact->Send();
}
function sendnewsletter($toemail, $newslettersubject, $newsletter, $sendername, $senderemail)
{
    /*Setting Email Body and Sending*/
    $rs_qry_noreply = mysql_query("SELECT noreplyemail,notifyemail FROM mac_admin") or die(mysql_error());
    $row_qry_noreply = mysql_fetch_array($rs_qry_noreply);
    $noreply_email = $row_qry_noreply['noreplyemail'];
    $notifyemail = $row_qry_noreply['notifyemail'];
    $rs_qry = mysql_query("SELECT act_code,id FROM mac_newletter_subscriber WHERE sub_email = '" . $toemail . "'") or die(mysql_error());
    $row_qry = mysql_fetch_array($rs_qry);
    $toemailid = $row_qry['id'];
    $encode_str = "message.php?act_str_unsub=" . $act_code . "&unsubid=";
    $encode_id = base64_encode($toemailid);
    $unscribe_link = 'Click <a href="' . MYSURL . $encode_str . $encode_id . '">Unsubscribe Now</a> if you do not wish to get any more newsletters from Unique Hijabs';
    $search = array('{UNSUBSCRIBE_LINK}');
    $replace = array($unscribe_link);
    $newsletter_body = str_replace($search, $replace, stripslashes($newsletter));
    $mContact = new Mail();
    $mContact->ReplyTo($noreply_email);
    $mContact->To($toemail);
    $mContact->Subject($newslettersubject);
    //$mContact->Envelope('-f'.$notifyemail);
    $mContact->Body($newsletter_body);
    $mContact->Priority(2);
    $mContact->Send();
}
Example #13
-3
 /**
  * Функция для отправки писем в UTF-8
  * @param $dataMail - массив с данными
  * <code>
  * array(
  * nameFrom => имя отправителя
  * emailFrom => email отправителя
  * nameTo => имя получателя
  * emailTo => email получателя
  * dataCharset => кодировка переданных данных
  * sendCharset => кодировка письма
  * subject => тема письма
  * body => текст письма
  * html => письмо в виде html или обычного текста
  * addheaders => дополнительные заголовки
  * contentType => если нужен особенный contentType
  * ); 
  * </code>
  * @return bool
  */
 public static function sendMimeMail($dataMail)
 {
     $m = new Mail();
     // можно сразу указать кодировку, можно ничего не указывать ($m= new Mail;)
     $m->From(htmlspecialchars_decode($dataMail['nameFrom']) . "||" . $dataMail['emailFrom']);
     // от кого Можно использовать имя, отделяется точкой с запятой
     if (MG::getSetting('smtp') === "true") {
         $m->smtp_on(MG::getSetting('smtpHost'), MG::getSetting('smtpLogin'), MG::getSetting('smtpPass'), MG::getSetting('smtpPort'), 10);
         // используя эу команду отправка пойдет через smtp
         $m->From($dataMail['nameFrom'] . "||" . MG::getSetting('smtpLogin'));
     }
     $m->ReplyTo(htmlspecialchars_decode(self::$replyTo));
     // куда ответить, тоже можно указать имя
     $m->To($dataMail['nameTo'] . "||" . $dataMail['emailTo']);
     // кому, в этом поле так же разрешено указывать имя
     $dataMail['subject'] = htmlspecialchars_decode($dataMail['subject']);
     $m->Subject($dataMail['subject']);
     if (!empty($dataMail['html'])) {
         $m->Body($dataMail['body'], "html");
     } else {
         $m->Body($dataMail['body']);
     }
     $m->Priority(4);
     // установка приоритета
     //$m->Attach( "/toto.gif", "", "image/gif" ) ;	// прикрепленный файл типа image/gif. типа файла указывать не обязательно
     $m->log_on(true);
     // включаем лог, чтобы посмотреть служебную информацию
     $m->Send();
     // отправка
     self::$replyTo = null;
     //  echo "Письмо отправлено, вот исходный текст письма:<br><pre>", $m->Get(), "</pre>";
     // exit();
 }