-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from u-wlkjyy/accountSearch
优化了IMAP邮箱搜索逻辑,通过生成的账号进行搜索
- Loading branch information
Showing
2 changed files
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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): | ||
""" | ||
|
@@ -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 | ||
|
||
|