$account->load($account_id); $smtp = CExchangeSource::get("mediuser-{$account->object_id}", 'smtp'); if (!$smtp->_id) { $smarty = new CSmartyDP(); $smarty->assign('msg', CAppUI::tr('CUserMail-msg-no_smtp_source_linked_to_pop_account')); $smarty->assign('type', 'error'); $smarty->assign('modal', 1); $smarty->assign('close_modal', 1); $smarty->display('inc_display_msg.tpl'); CApp::rip(); } $mail = new CUserMail(); if ($mail_id) { $mail->load($mail_id); if ($mail->text_html_id) { $mail->loadContentHTML(); $mail->_content = $mail->_text_html->content; } elseif ($mail->text_plain_id) { $mail->loadContentPlain(); $mail->_content = $mail->_text_plain->content; } } else { $mail->from = $account->user; $mail->account_class = $account->_class; $mail->account_id = $account->_id; $mail->draft = '1'; if ($reply_to_id) { $mail->in_reply_to_id = $reply_to_id; $reply_to = new CUserMail(); $reply_to->load($reply_to_id); $mail->to = $reply_to->from;