# ── config ─────────────────────────────────────────────────────────────────
config = configparser.ConfigParser()
- config.read(
- os.path.join(os.path.dirname(os.path.abspath(__file__)), "wechat_auto_login.ini"),
- encoding="utf-8",
- )
+ _cfg_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "wechat_auto_login.ini")
+ try:
+ with open(_cfg_path, "r", encoding="gbk") as _f:
+ config.read_file(_f)
+ except Exception:
+ config.read(_cfg_path, encoding="utf-8")
EMAIL_ENABLED = config.getboolean("Email", "email_enabled", fallback=True)
SMTP_SERVER = config.get("Email", "smtp_server", fallback="smtp.qq.com")
SMTP_PORT = config.getint("Email", "smtp_port", fallback=465)