Skip to content

Commit

Permalink
Merge pull request #247 from u-wlkjyy/accountSearch
Browse files Browse the repository at this point in the history
优化了IMAP邮箱搜索逻辑,通过生成的账号进行搜索
  • Loading branch information
chengazhen authored Feb 28, 2025
2 parents 3182b1d + 9881061 commit e9c3bb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cursor_pro_keep_alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,6 @@ def print_end_message():
# 获取并打印浏览器的user-agent
user_agent = browser.latest_tab.run_js("return navigator.userAgent")

logging.info("正在初始化邮箱验证模块...")
email_handler = EmailVerificationHandler()
logging.info(
"请前往开源项目查看更多信息:https://github.com/chengazhen/cursor-auto-free"
)
Expand All @@ -463,7 +461,13 @@ def print_end_message():
first_name = email_generator.default_first_name
last_name = email_generator.default_last_name


logging.info(f"生成的邮箱账号: {account}")

logging.info("正在初始化邮箱验证模块...")
email_handler = EmailVerificationHandler(account)


auto_update_cursor_auth = True

tab = browser.latest_tab
Expand Down
5 changes: 3 additions & 2 deletions get_email_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@


class EmailVerificationHandler:
def __init__(self):
def __init__(self,account):
self.imap = Config().get_imap()
self.username = Config().get_temp_mail()
self.epin = Config().get_temp_mail_epin()
self.session = requests.Session()
self.emailExtension = Config().get_temp_mail_ext()
self.account = account

def get_verification_code(self, max_retries=5, retry_interval=60):
"""
Expand Down Expand Up @@ -67,7 +68,7 @@ def _get_mail_code_by_imap(self, retry = 0):
mail.login(self.imap['imap_user'], self.imap['imap_pass'])
mail.select(self.imap['imap_dir'])

status, messages = mail.search(None, 'FROM', '"[email protected]"')
status, messages = mail.search(None, 'TO', '"'+self.account+'"')
if status != 'OK':
return None

Expand Down

0 comments on commit e9c3bb3

Please sign in to comment.