示例#1
0
 /**
  * @desc Envía correo de aprobación de publicación
  * @param Object $res Publicación
  **/
 function mail_approved(RDResource &$res)
 {
     global $xoopsModuleConfig, $xoopsConfig;
     $config_handler =& xoops_gethandler('config');
     $mconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
     $errors = '';
     $user = new XoopsUser($res->getVar('owner'));
     $member_handler =& xoops_gethandler('member');
     $method = $user->getVar('notify_method');
     $mailer = new RMMailer('text/plain');
     $mailer->add_xoops_users($user);
     $mailer->set_subject(sprintf(__('Publication <%s> approved!', 'docs'), $res->getVar('title')));
     $mailer->assign('dear_user', $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname'));
     $mailer->assign('link_to_resource', $res->permalink());
     $mailer->assign('site_name', $xoopsConfig['sitename']);
     $mailer->assign('resource_name', $res->getVar('title'));
     $mailer->template(RMTemplate::get()->get_template('mail/resource_approved.php', 'module', 'docs'));
     switch ($method) {
         case '1':
             $mailer->set_from_xuser($mconfig['fromuid']);
             $ret = $mailer->send_pm();
             break;
         case '2':
             $ret = $mailer->send();
             break;
     }
     $page = rmc_server_var($_POST, 'page', 1);
     return $ret;
 }
示例#2
0
/**
* Send mail to selected users using Swift
*/
function send_mail()
{
    global $rmc_config, $xoopsConfig;
    extract($_POST);
    // Creating a message
    $mailer = new RMMailer($type == 'html' ? 'text/html' : 'text/plain');
    $mailer->add_xoops_users($mailer_users);
    $mailer->set_subject($subject);
    $message = $type == 'html' ? TextCleaner::getInstance()->to_display($message) : $message;
    $mailer->set_body($message);
    if (!$mailer->batchSend()) {
        xoops_cp_header();
        echo "<h3>" . __('There was errors while sending this emails', 'rmcommon') . "</h3>";
        foreach ($mailer->errors() as $error) {
            echo "<div class='even'>" . $error . "</div>";
        }
        xoops_cp_footer();
    }
    redirectMsg('users.php?' . base64_decode($query), __('Message sent successfully!', 'rmcommon'), 0);
}