c5_labsci/web/admin/demo/dyn/mail.php

37 lines
1.2 KiB
PHP

<?php
namespace web\admin\demo\dyn;
class mail {
public static function json_mailsend() {
$post = new \ciy\post();
$mail = new \ciy\smtp();
$mail->smtp_server = $post->get('smtpserver');
$mail->smtp_port = $post->getint('smtpport');
$mail->user = $post->get('user');
$mail->pass = $post->get('pass');
$param = array();
$param['mailto'] = $post->get('mailto');
$param['title'] = $post->get('title');
$param['content'] = $post->get('content','','all');
$retmail = $mail->sendmail($param);
clog($mail->log);
if(is_string($retmail))
return errjson($retmail);
return succjson();
}
public static function json_mailrecv() {
$post = new \ciy\post();
$mail = new \ciy\imap();
$mail->imap_server = $post->get('imapserver');
$mail->user = $post->get('user');
$mail->pass = $post->get('pass');
$lastuid = $post->getint('lastuid');
$retmail = $mail->recvmail($lastuid);
clog($mail->log);
if(is_string($retmail))
return errjson($retmail);
return succjson($retmail);
}
}