【FoxMail】无法登录, 一直让创建问题.

本文介绍了当非超级管理员用户在公司电脑上使用Foxmail时遇到的登录问题及解决方案。通过设置以管理员身份运行,可以避免每次手动选择,确保软件正常启动。

问题原因:

  每次打开FoxMail的时候都显示创建, 创建完成之后,再次打开FoxMail还是显示创建.

  出现这个现象的原因是因为使用的公司电脑, 我登录电脑的账号并非超级管理员,

  因此导致无法登录.

解决方式:  右键快捷图标, 点击"以管理员身份运行", 即可直接登录进去.

但是每次打开软件都需要右键选择"以管理员运行"很麻烦. 而且, 对于有些

软件我们是开机运行的, 这里我们要怎么办呢?

可以通过右键 -> 属性 -> 兼容性 -> 选择"以管理员身份运行此程序",

然后点击"确定" , 这样对于开机自动运行的软件也可以正常打开了.

代码能否修改为后台收取,每次窗口置顶影响工作 import subprocess import time import pyautogui import psutil import argparse import os import requests import logging # 配置日志记录 logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[ logging.FileHandler("D:\\pybat\\mail.log", encoding='utf-8'), logging.StreamHandler() ] ) class EmailClient: def __init__(self, outlook_path=None, foxmail_path=None): self.outlook_path = outlook_path or r"C:\Program Files\Microsoft Office\Office16\OUTLOOK.EXE" self.foxmail_path = foxmail_path or r"D:\software\Foxmail7.2\Foxmail\Foxmail.exe" def _activate_window(self, title_keyword): try: import pygetwindow as gw windows = gw.getWindowsWithTitle(title_keyword) if windows: win = windows[0] if win.isMinimized: win.restore() win.activate() time.sleep(1) return True except: pyautogui.hotkey('alt', 'tab') time.sleep(1) return False return False def _is_process_running(self, process_name): for proc in psutil.process_iter(['name']): if proc.info['name'].lower() == process_name.lower(): return True return False def fetch_outlook_emails(self, close_after=False): try: if not self._is_process_running("OUTLOOK.EXE"): subprocess.Popen(self.outlook_path) logging.info("启动Outlook...") time.sleep(15) if not self._activate_window("Outlook"): logging.warning("警告:无法激活Outlook窗口,请确保它在前台") pyautogui.press('f9') logging.info("正在收取Outlook邮件...") time.sleep(25) if close_after: pyautogui.hotkey('alt', 'f4') logging.info("已关闭Outlook") return True except Exception as e: logging.error(f"Outlook操作失败: {e}") return False def fetch_foxmail_emails(self, close_after=False): try: if not self._is_process_running("Foxmail.exe"): subprocess.Popen(self.foxmail_path) logging.info("启动Foxmail...") time.sleep(15) if not self._activate_window("Foxmail"): logging.warning("警告:无法激活Foxmail窗口,请确保它在前台") pyautogui.press('f4') logging.info("正在收取Foxmail邮件...") time.sleep(25) if close_after: try: # 直接杀掉所有 foxmail.exe 进程 result = os.system("taskkill /f /im foxmail.exe") if result == 0: logging.info("已杀掉 Foxmail 进程") else: logging.info("未找到 Foxmail 进程") except Exception as e: logging.error(f"杀掉 Foxmail 进程时出错: {e}") return True except Exception as e: logging.error(f"Foxmail操作失败: {e}") return False def delete_large_log_file(file_path="D:\\pybat\\mail.log", max_size_mb=10): """ 检查指定文件的大小,如果超过指定大小则删除该文件 参数: file_path (str): 文件路径,默认为 "D:\\pybat\\mail.log" max_size_mb (int): 最大大小限制(MB),默认为 10MB 返回: bool: 删除成功返回True,未删除或出错返回False """ try: # 检查文件是否存在 if not os.path.exists(file_path): logging.info(f"文件不存在: {file_path}") return False # 获取文件大小(字节) file_size = os.path.getsize(file_path) # 转换为MB file_size_mb = file_size / (1024 * 1024) print(f"文件大小: {file_size_mb:.2f} MB") # 如果文件大小超过限制 if file_size_mb > max_size_mb: # 删除文件 os.remove(file_path) logging.info(f"文件已删除: {file_path} (大小: {file_size_mb:.2f} MB)") return True else: logging.info(f"文件大小正常,无需删除") return False except Exception as e: logging.info(f"处理文件时出错: {e}") return False def check_internet(): try: requests.get("https://oa.hikvision.com.cn/", timeout=5) return True except: return False def main(): parser = argparse.ArgumentParser(description="自动收取邮件工具") parser.add_argument('--outlook', action='store_true', help='收取Outlook邮件') parser.add_argument('--foxmail', action='store_true', help='收取Foxmail邮件') parser.add_argument('--close', action='store_true', help='完成后关闭客户端') parser.add_argument('--outlook-path', help='自定义Outlook路径') parser.add_argument('--foxmail-path', help='自定义Foxmail路径') args = parser.parse_args() client = EmailClient( outlook_path=args.outlook_path, foxmail_path=args.foxmail_path ) delete_large_log_file() if check_internet(): logging.info("网络连接正常") logging.info("===== 开始处理Outlook邮件 =====") client.fetch_outlook_emails(close_after=False) logging.info("===== 开始处理Foxmail邮件 =====") client.fetch_foxmail_emails(close_after=True) else: logging.warning("网络不可用,延迟执行") if __name__ == "__main__": main()
最新发布
10-23
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值