diff --git a/plugins/mail/index.html b/plugins/mail/index.html
index aa6ab36a2..a8c3a2e59 100755
--- a/plugins/mail/index.html
+++ b/plugins/mail/index.html
@@ -1,10 +1,8 @@
\ No newline at end of file
diff --git a/plugins/mail/index.py b/plugins/mail/index.py
index 69359867e..81c8295c4 100755
--- a/plugins/mail/index.py
+++ b/plugins/mail/index.py
@@ -31,23 +31,8 @@ def getInitDFile():
return '/etc/init.d/' + getPluginName()
-def getConf():
- path = getServerDir() + "/redis.conf"
- return path
-
-
-def getConfTpl():
- path = getPluginDir() + "/config/redis.conf"
- return path
-
-
-def getInitDTpl():
- path = getPluginDir() + "/init.d/" + getPluginName() + ".tpl"
- return path
-
-
def getArgs():
- args = sys.argv[2:]
+ args = sys.argv[3:]
tmp = {}
args_len = len(args)
@@ -72,144 +57,6 @@ def status():
return 'start'
-def initDreplace():
-
- file_tpl = getInitDTpl()
- service_path = os.path.dirname(os.getcwd())
-
- initD_path = getServerDir() + '/init.d'
- if not os.path.exists(initD_path):
- os.mkdir(initD_path)
- file_bin = initD_path + '/' + getPluginName()
-
- # initd replace
- if not os.path.exists(file_bin):
- content = mw.readFile(file_tpl)
- content = content.replace('{$SERVER_PATH}', service_path)
- mw.writeFile(file_bin, content)
- mw.execShell('chmod +x ' + file_bin)
-
- # log
- dataLog = getServerDir() + '/data'
- if not os.path.exists(dataLog):
- mw.execShell('chmod +x ' + file_bin)
-
- # config replace
- dst_conf = getServerDir() + '/redis.conf'
- dst_conf_init = getServerDir() + '/init.pl'
- if not os.path.exists(dst_conf_init):
- conf_content = mw.readFile(getConfTpl())
- conf_content = conf_content.replace('{$SERVER_PATH}', service_path)
- mw.writeFile(dst_conf, conf_content)
- mw.writeFile(dst_conf_init, 'ok')
-
- # systemd
- systemDir = mw.systemdCfgDir()
- systemService = systemDir + '/redis.service'
- systemServiceTpl = getPluginDir() + '/init.d/redis.service.tpl'
- if os.path.exists(systemDir) and not os.path.exists(systemService):
- service_path = mw.getServerDir()
- se_content = mw.readFile(systemServiceTpl)
- se_content = se_content.replace('{$SERVER_PATH}', service_path)
- mw.writeFile(systemService, se_content)
- mw.execShell('systemctl daemon-reload')
-
- return file_bin
-
-
-def redisOp(method):
- file = initDreplace()
-
- if not mw.isAppleSystem():
- data = mw.execShell('systemctl ' + method + ' redis')
- if data[1] == '':
- return 'ok'
- return 'fail'
-
- data = mw.execShell(file + ' start')
- if data[1] == '':
- return 'ok'
- return 'fail'
-
-
-def start():
- return redisOp('start')
-
-
-def stop():
- return redisOp('stop')
-
-
-def restart():
- status = redisOp('restart')
-
- log_file = runLog()
- mw.execShell("echo '' > " + log_file)
- return status
-
-
-def reload():
- return redisOp('reload')
-
-
-def runInfo():
- cmd = getServerDir() + "/bin/redis-cli info"
- data = mw.execShell(cmd)[0]
- res = [
- 'tcp_port',
- 'uptime_in_days', # 已运行天数
- 'connected_clients', # 连接的客户端数量
- 'used_memory', # Redis已分配的内存总量
- 'used_memory_rss', # Redis占用的系统内存总量
- 'used_memory_peak', # Redis所用内存的高峰值
- 'mem_fragmentation_ratio', # 内存碎片比率
- 'total_connections_received', # 运行以来连接过的客户端的总数量
- 'total_commands_processed', # 运行以来执行过的命令的总数量
- 'instantaneous_ops_per_sec', # 服务器每秒钟执行的命令数量
- 'keyspace_hits', # 查找数据库键成功的次数
- 'keyspace_misses', # 查找数据库键失败的次数
- 'latest_fork_usec' # 最近一次 fork() 操作耗费的毫秒数
- ]
- data = data.split("\n")
- result = {}
- for d in data:
- if len(d) < 3:
- continue
- t = d.strip().split(':')
- if not t[0] in res:
- continue
- result[t[0]] = t[1]
- return mw.getJson(result)
-
-
-def initdStatus():
- if mw.isAppleSystem():
- return "Apple Computer does not support"
-
- shell_cmd = 'systemctl status redis | grep loaded | grep "enabled;"'
- data = mw.execShell(shell_cmd)
- if data[0] == '':
- return 'fail'
- return 'ok'
-
-
-def initdInstall():
- if mw.isAppleSystem():
- return "Apple Computer does not support"
-
- mw.execShell('systemctl enable redis')
- return 'ok'
-
-
-def initdUinstall():
-
- if mw.isAppleSystem():
- return "Apple Computer does not support"
-
- mw.execShell('systemctl disable redis')
- return 'ok'
-
-
def runLog():
path = '/var/log/maillog'
# if "ubuntu" in:
@@ -220,22 +67,6 @@ if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
print(status())
- elif func == 'start':
- print(start())
- elif func == 'stop':
- print(stop())
- elif func == 'restart':
- print(restart())
- elif func == 'reload':
- print(reload())
- elif func == 'initd_status':
- print(initdStatus())
- elif func == 'initd_install':
- print(initdInstall())
- elif func == 'initd_uninstall':
- print(initdUinstall())
- elif func == 'run_info':
- print(runInfo())
elif func == 'conf':
print(getConf())
elif func == 'run_log':
diff --git a/plugins/mail/info.json b/plugins/mail/info.json
index 36c333647..222e411ca 100755
--- a/plugins/mail/info.json
+++ b/plugins/mail/info.json
@@ -2,7 +2,7 @@
"sort": 7,
"ps": "简单邮件服务[DEV]",
"name": "mail",
- "title": "mail",
+ "title": "邮件服务",
"shell": "install.sh",
"versions":["1.0"],
"updates":["1.0"],
diff --git a/plugins/mail/js/mail.js b/plugins/mail/js/mail.js
index 5f5ce730d..f72218f98 100755
--- a/plugins/mail/js/mail.js
+++ b/plugins/mail/js/mail.js
@@ -64,3 +64,129 @@ function mailPostCallbak(method, version, args,callback){
},'json');
}
+
+function domainList(){
+ var con = '
\
+
\
+ \
+
\
+
\
+
\
+ \
+ \
+ 邮箱域名 | \
+ MX记录 | \
+ A记录 | \
+ SPF记录 | \
+ DKIM记录 | \
+ DMARC记录 | \
+ CatchAll | \
+ SSL | \
+ 操作 | \
+
\
+ \
+ \
+
\
+
\
+
\
+
\
+ - \
+ 添加域名后,需要添加MX记录(用于邮箱服务)和TXT记录(用于邮箱反垃圾服务)才能正常使用邮箱服务。\
+
\
+ - \
+ 提示: 部分云厂商(如:阿里云,腾讯云)默认关闭25端口,需联系厂商开通25端口后才能正常使用邮局服务\
+
\
+ - 该自建邮局版本为基础版本,仅提供基础功能,更多功能请耐心等候开发进度。
\
+
\
+
';
+
+ $(".soft-man-con").html(con);
+}
+
+
+
+function serviceStatus(){
+ var con = '
\
+
\
+ \
+ \
+ 服务名称 | \
+ 服务状态 | \
+ 操作 | \
+
\
+ \
+ \
+ \
+ Dovecot | \
+ 获取中... | \
+ \
+ 启动\
+ 停止 | \
+ 重启 | \
+ 修复 | \
+ 获取中... | \
+ \
+ 启动\
+ 停止 | \
+ 重启 | \
+ 修复 | \
+ 配置文件\
+ | \
+
\
+ \
+ Rspamd | \
+ 获取中... | \
+ \
+ 启动\
+ 停止 | \
+ 重启 | \
+ 修复 | \
+ 配置文件\
+ | \
+
\
+ \
+ Postfix | \
+ 获取中... | \
+ \
+ 启动\
+ 停止 | \
+ 重启 | \
+ 修复 | \
+ 配置文件\
+ | \
+
\
+ \
+
\
+
';
+ $(".soft-man-con").html(con);
+}
+
diff --git a/plugins/mail/versions/1.0/install.sh b/plugins/mail/versions/1.0/install.sh
index 57b7798ff..337d17960 100755
--- a/plugins/mail/versions/1.0/install.sh
+++ b/plugins/mail/versions/1.0/install.sh
@@ -112,6 +112,10 @@ Install_App()
if [ ! -f "/etc/dovecot/dh.pem" ] || [ $filesize -lt 300 ]; then
openssl dhparam 2048 > /etc/dovecot/dh.pem
fi
+
+ mkdir -p $serverPath/mail
+ echo '1.0' > $serverPath/mail/version.pl
+ echo '安装完成' > $install_tmp
}
Uninstall_App()
diff --git a/plugins/mail/versions/1.0/install_centos.sh b/plugins/mail/versions/1.0/install_centos.sh
index 181c8db23..e30a78a16 100644
--- a/plugins/mail/versions/1.0/install_centos.sh
+++ b/plugins/mail/versions/1.0/install_centos.sh
@@ -70,12 +70,12 @@ Install_centos7() {
}
install_rspamd() {
- if [[ $systemver = "7" ]];then
+ if [[ $OSNAME_ID = "7" ]];then
wget -O /etc/yum.repos.d/rspamd.repo https://rspamd.com/rpm-stable/centos-7/rspamd.repo
rpm --import https://rspamd.com/rpm-stable/gpg.key
yum makecache
yum install rspamd -y
- elif [ $systemver = "8" ]; then
+ elif [ $OSNAME_ID = "8" ]; then
wget -O /etc/yum.repos.d/rspamd.repo https://rspamd.com/rpm-stable/centos-8/rspamd.repo
rpm --import https://rspamd.com/rpm-stable/gpg.key
yum makecache