<?php
include_once("c_setting_config.php");
class c_page_cab_setting_sendmail extends c_page_cab_setting_config
{
  public $h1='Настройка параметров отправки почты' ;

 function block_main()
 { $this->page_title() ;

   ?><form><table class="setting">
             <tr><td colspan="2"><strong>Настройки доступа к почтовому ящику, протокол SMTP</strong></td></tr>
             <tr><td>server adress</td><td><input type="text" name="setting[LS_smtp_server]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_server'])?>"></td></tr>
             <tr><td>server port</td><td><input type="text" name="setting[LS_smtp_port]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_port'])?>"></td></tr>
             <tr><td>user login</td><td><input type="text" name="setting[LS_smtp_login]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_login'])?>"></td></tr>
             <tr><td>user pass</td><td><input type="password" name="setting[LS_smtp_pass]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_pass'])?>"></td></tr>
             <tr><td>from</td><td><input type="text" name="setting[LS_smtp_from]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_from'])?>"></td></tr>
             <tr><td>from name</td><td><input type="text" name="setting[LS_smtp_from_name]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_from_name'])?>"></td></tr>
             <tr><td>secure mode</td><td><input type="text" name="setting[LS_smtp_secure]" value="<?echo htmlspecialchars($GLOBALS['LS_smtp_secure'])?>"></td></tr>
             <tr><td></td><td><button class="v2" cmd="aspmo_setting/save_setting">Сохранить</button></td></tr>
          </table></form><?

   $this->panel_check_send_mail() ;
 }

 function panel_check_send_mail()
 { ?><h2>Проверка отправки почты</h2>
     <form><table class="basic fz_small left">
        <tr><td>Еmail:</td><td><input type=text size=40 name=to_email value="<?echo $_POST['to_email']?>"></td></tr>
        <tr><td>Тема:</td><td><input size=40 type=text name=thema value=<?echo $_POST['thema']?>></td></tr>
        <tr><td>Содержание:</td><td><input size=40 type=text name=value value=<?echo $_POST['value']?>></td></tr>
     </table><br><br>
     <input type="submit" class=v1 cmd=test_send_mail></form>
   <?

 }

  function CMD_test_send_mail()
  {   if ($_POST['to_email'] and $_POST['thema'] and $_POST['value'])
      { ?><h2>Отправляем почту</h2><?
        $options=array() ;
        $options['no_asyns_send_mail']=1 ;
        $options['debug']=2 ;
        if ($_POST['debug']) $options['debug']=$_POST['debug'] ;
        $options['html']=1 ;
        $options['reg_events']=1 ;
        $options['send_method']='smtp' ;
        $options['account']=$_POST['SMTP'] ;

        ob_start() ;
        _send_mail($_POST['to_email'],$_POST['thema'],$_POST['value'] ,$options) ;
        $text=ob_get_clean() ;
        echo str_replace($GLOBALS['mail_options']['smtp_password'],'******',$text) ;
      }

  }



}



?>