按照最新官网文档搭建登录后,配置邮件设置,发送测试邮件报错



  • 在系统管理--邮件设置页面,按照文档配置后,点击测试邮件报错“402 POST /v2/sysconfig/settings/set/ (127.0.0.1): csrf error
    [W 200316 17:09:15 web:2246] 402 POST /v2/sysconfig/settings/set/ (127.0.0.1) 1.72ms”
    如果只点击一次的话,日志中post操作的时间超长,而且我更换了很多公共邮箱和公司邮箱多不能发出邮件。显示超长时间的日志如下“200 POST /v2/sysconfig/check/ (127.0.0.1) 127220.43ms”。请指导!



  • @tom2ling

    mg.log,刚才点击测试邮件后产生的日志
    [I 200320 15:12:09 web:2246] 200 POST /login/ (127.0.0.1) 22.99ms
    [I 200320 15:12:09 web:2246] 200 GET /authorization/ (127.0.0.1) 6.18ms
    [I 200320 15:12:26 web:2246] 304 GET /v2/sysconfig/settings/all/ (127.0.0.1) 8.31ms
    [E 200320 15:12:41 base:680] Exception during reset or similar
    Traceback (most recent call last):
    File "/usr/local/lib/python3.6/site-packages/sqlalchemy/event/base.py", line 83, in init
    self._empty_listeners = self._empty_listener_reg[instance_cls]
    File "/usr/local/lib/python3.6/weakref.py", line 394, in getitem
    return self.data[ref(key)]
    KeyError: <weakref at 0x7f3264822db8; to 'type' at 0x2191b18 (Session)>

    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 671, in _finalize_fairy
        fairy._reset(pool)
      File "/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py", line 858, in _reset
        pool._dialect.do_rollback(self)
      File "/usr/local/lib/python3.6/site-packages/sqlalchemy/dialects/mysql/base.py", line 2227, in do_rollback
        dbapi_connection.rollback()
      File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 430, in rollback
        self._read_ok_packet()
      File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 394, in _read_ok_packet
        pkt = self._read_packet()
      File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 657, in _read_packet
        packet_header = self._read_bytes(4)
      File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 707, in _read_bytes
        CR.CR_SERVER_LOST, "Lost connection to MySQL server during query")
    pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
    

    [I 200320 15:12:41 web:2246] 200 GET /v2/accounts/user/?page=1&limit=15 (127.0.0.1) 37.97ms
    [I 200320 15:15:02 web:2246] 304 GET /v2/accounts/func/?page=1&limit=15 (127.0.0.1) 14.78ms
    [I 200320 15:15:04 web:2246] 304 GET /v2/accounts/menus/ (127.0.0.1) 11.49ms
    [I 200320 15:15:04 web:2246] 304 GET /v2/accounts/components/ (127.0.0.1) 9.17ms
    [I 200320 16:46:43 web:2246] 304 GET /v2/accounts/role/?page=1&limit=14 (127.0.0.1) 12.06ms
    [I 200320 16:46:50 web:2246] 304 GET /v2/sysconfig/settings/all/ (127.0.0.1) 12.83ms
    [W 200320 16:48:03 web:1782] 402 POST /v2/sysconfig/check/ (127.0.0.1): csrf error
    [W 200320 16:48:03 web:2246] 402 POST /v2/sysconfig/check/ (127.0.0.1) 2.04ms
    [I 200320 16:50:09 web:2246] 200 POST /v2/sysconfig/check/ (127.0.0.1) 127352.43m



  • 检查点击测试的用户是否配置邮箱



  • @zhangpengfei 邮箱账号密码完全按照文档要求,密码是授权码,还花了不少短信费。



  • @tom2ling 不是系统配置的邮箱,是当前登录用户是否有配置邮箱



  • @woniu 都配置了邮箱,而且是可以正常接收的,我服务端配置的是qq邮箱,我用户配置的是163和126两个邮箱,这两个账号都不能接收,因为不能接收所以不知道密码,所以用户不能使用



  • @tom2ling 用foxmail进行同样配置,就可以配置成功。下面贴出我openresety网关服务内置nginx的错误日志:
    2020/03/24 15:36:04 [error] 663#663: *2296 [lua] upstream.lua:48: set(): real_uri-------->/v2/sysconfig/settings/set/, client: 192.168.6.39, server: gw.opendevops.cn, request: "POST /api/mg/v2/sysconfig/settings/set/ HTTP/1.1", host: "gw.opendevops.cn:8888", referrer: "http://demo-init.opendevops.cn/systemmanage/system"
    2020/03/24 15:36:08 [error] 663#663: *2303 [lua] access_check.lua:18: acc-->>>accounts, client: 192.168.6.39, server: gw.opendevops.cn, request: "GET /api/accounts/authorization/ HTTP/1.1", host: "gw.opendevops.cn:8888", referrer: "http://demo-init.opendevops.cn/systemmanage/system"
    2020/03/24 15:36:08 [error] 663#663: *2303 [lua] upstream.lua:48: set(): real_uri-------->/authorization/, client: 192.168.6.39, server: gw.opendevops.cn, request: "GET /api/accounts/authorization/ HTTP/1.1", host: "gw.opendevops.cn:8888", referrer: "http://demo-init.opendevops.cn/systemmanage/system"
    2020/03/24 15:36:09 [error] 663#663: *2306 [lua] upstream.lua:48: set(): real_uri-------->/v2/sysconfig/settings/all/, client: 192.168.6.39, server: gw.opendevops.cn, request: "GET /api/mg/v2/sysconfig/settings/all/ HTTP/1.1", host: "gw.opendevops.cn:8888", referrer: "http://demo-init.opendevops.cn/systemmanage/system"
    2020/03/24 15:36:32 [error] 664#664: *2311 [lua] upstream.lua:48: set(): real_uri-------->/v2/sysconfig/check/, client: 192.168.6.39, server: gw.opendevops.cn, request: "POST /api/mg/v2/sysconfig/check/ HTTP/1.1", host: "gw.opendevops.cn:8888", referrer: "http://demo-init.opendevops.cn/systemmanage/system"
    2020/03/24 15:36:44 [error] 664#664: *2318 [lua] upstream.lua:48: set(): real_uri-------->/v2/sysconfig/settings/set/, client: 192.168.6.39, server: gw.opendevops.cn, request: "POST /api/mg/v2/sysconfig/settings/set/ HTTP/1.1", host: "gw.opendevops.cn:8888", referrer: "http://demo-init.opendevops.cn/systemmanage/system"


登录后回复