We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
网易系邮箱使用imap协议登录获取邮件时首先要求附带联系信息,这一步已经解决了,然后使用mail.search(None, 'ALL')也能获取到全部邮件列表信息,但是使用mail.search(None, 'TO', '"[email protected]"') 、mail.search(None, 'FROM', '"[email protected]"') 、mail.search(None, 'subject', '"cursorxxx"')等命令均返回空列表,或者一些网上看到的实例写法均未成功,不知道有没有啥解决方案。 mail = imaplib.IMAP4_SSL(self.imap['imap_server'], self.imap['imap_port']) mail.login(self.imap['imap_user'], self.imap['imap_pass']) imap_id = ("name", "xxx", "contact", "[email protected]", "version", "1.0.0", "vendor", "imaplib") mail.xatom('ID', '("' + '" "'.join(imap_id) + '")') mail.select(self.imap['imap_dir']) addr_from='[email protected]' search_cmd=f'(FROM "{addr_from}")' status, messages = mail.search(None,search_cmd)
使用ALL命令搜索解读的邮件属性:
function variables: 00: ('Received', 'from i-ih.cloudflare-email.net (unknown [104.3])\r\n\tby gzga-mx-mtada-g7-9 (Corem...3;\r\n\tFri, 28 Feb 2025 12:47:57 +0800 (CST)') 01: ('DKIM-Signature', 'v=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-email.net; c=relaxed/relaxed;\r\n\th=To:Subj...BXRc\r\n\tm8GWVvtpuw==;') 02: ('X-Forwarded-To', '[email protected]') 03: ('X-Forwarded-For', '[email protected] [email protected]') 04: ('Received', 'from o1.ptr7413.workos.com (159.183.xx)\r\n by cloudflare-email.net (unknown...xxx.com>; Fri, 28 Feb 2025 04:47:51 +0000') 05: ('ARC-Seal', 'i=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-email.net; cv=none;\r\n\tb=RD9bYB/D7xam/hg==;') 06: ('ARC-Message-Signature', 'i=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-email.net; c=relaxed/relaxed;\r\n\th=To:Subj...hAmcxUMdQ==;') 07: ('ARC-Authentication-Results', 'i=1; mx.cloudflare.net;\r\n\tdkim=pass header.d=cursor.sh header.s=wos header.b=W03vwp5N...;\r\n\tarc=none smtp.remote-ip=15x15') 08: ('Received-SPF', 'pass (mx.cloudflare.net: domain of bounces+42524694-5042-timea7986=[email protected]...75.cursor.sh"; helo=o1.ptr7413.workos.com;') 09: ('X-CF-SpamH-Score', '1') 10: ('DKIM-Signature', 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=cursor.sh;\r\n\th=content-type:from:mime-version...dfVmXxtGg==') 11: ('Received', 'by recvd-5fb76865d7-qmshh with SMTP id recvd-5fb76865d7-qmshh-1-67C13FF6-E\r\n\t2025-02-...0.739446787 +0000 UTC m=+9098610.951488543') 12: ('Received', 'from NDI1MjQ2OTQ (unknown)\r\n\tby geopod-ismtpd-canary-0 (SG)\r\n\twith HTTP\r\n\tid Jz85xBj5...\tFri, 28 Feb 2025 04:47:50.693 +0000 (UTC)') 13: ('Content-Type', 'multipart/alternative; boundary=d31ed194cx905a5e77a44') 14: ('Date', 'Fri, 28 Feb 2025 04:47:50 +0000 (UTC)') 15: ('From', 'Cursor [email protected]') 16: ('Mime-Version', '1.0') 17: ('Message-ID', 'Jz85xBj5QUmY-g8iEvgxYw@geopod-ismtpd-canary-0') 18: ('Subject', 'Verify your email address') 19: ('X-SG-EID', '=?us-ascii?Q?u001=2ELu=2FEgxNG?=...=?us-ascii?Q?89HN=2xeqk5o=3D?=') 20: ('X-SG-ID', '=?us-ascii?Q?u001=2xD?=') 21: ('To', '[email protected]') 22: ('X-Entity-ID', 'u001.Zx6FngFgyAx9A==') 23: ('X-CM-TRANSID', '_____wD3rwf4P8x9S3') 24: ('Authentication-Results', 'gzga-mx-mtada-g7-9; spf=pass smtp.mail=cfbounc\r\n\[email protected]; dkim=pass head...mail.net; dkim=p\r\n\tass [email protected]') 25: ('X-Coremail-Antispam', '1Uf129KBjDUn29KB7ZKAUJUxIYCTnIWIevJa73UjIFyTuYvjxUOwIDDUUUU') 26: ('Sender', '[email protected]') len(): 27
The text was updated successfully, but these errors were encountered:
date = datetime.now().strftime("%d-%b-%Y") status, messages = mail.search(None, f'ON {date} UNSEEN') 使用日期搜索减少返回数
Sorry, something went wrong.
No branches or pull requests
网易系邮箱使用imap协议登录获取邮件时首先要求附带联系信息,这一步已经解决了,然后使用mail.search(None, 'ALL')也能获取到全部邮件列表信息,但是使用mail.search(None, 'TO', '"[email protected]"') 、mail.search(None, 'FROM', '"[email protected]"') 、mail.search(None, 'subject', '"cursorxxx"')等命令均返回空列表,或者一些网上看到的实例写法均未成功,不知道有没有啥解决方案。
mail = imaplib.IMAP4_SSL(self.imap['imap_server'], self.imap['imap_port'])
mail.login(self.imap['imap_user'], self.imap['imap_pass'])
imap_id = ("name", "xxx", "contact", "[email protected]", "version", "1.0.0", "vendor", "imaplib")
mail.xatom('ID', '("' + '" "'.join(imap_id) + '")')
mail.select(self.imap['imap_dir'])
addr_from='[email protected]'
search_cmd=f'(FROM "{addr_from}")'
status, messages = mail.search(None,search_cmd)
使用ALL命令搜索解读的邮件属性:
function variables:
00: ('Received', 'from i-ih.cloudflare-email.net (unknown [104.3])\r\n\tby gzga-mx-mtada-g7-9 (Corem...3;\r\n\tFri, 28 Feb 2025 12:47:57 +0800 (CST)')
01: ('DKIM-Signature', 'v=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-email.net; c=relaxed/relaxed;\r\n\th=To:Subj...BXRc\r\n\tm8GWVvtpuw==;')
02: ('X-Forwarded-To', '[email protected]')
03: ('X-Forwarded-For', '[email protected] [email protected]')
04: ('Received', 'from o1.ptr7413.workos.com (159.183.xx)\r\n by cloudflare-email.net (unknown...xxx.com>; Fri, 28 Feb 2025 04:47:51 +0000')
05: ('ARC-Seal', 'i=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-email.net; cv=none;\r\n\tb=RD9bYB/D7xam/hg==;')
06: ('ARC-Message-Signature', 'i=1; a=rsa-sha256; s=cf2024-1; d=cloudflare-email.net; c=relaxed/relaxed;\r\n\th=To:Subj...hAmcxUMdQ==;')
07: ('ARC-Authentication-Results', 'i=1; mx.cloudflare.net;\r\n\tdkim=pass header.d=cursor.sh header.s=wos header.b=W03vwp5N...;\r\n\tarc=none smtp.remote-ip=15x15')
08: ('Received-SPF', 'pass (mx.cloudflare.net: domain of bounces+42524694-5042-timea7986=[email protected]...75.cursor.sh"; helo=o1.ptr7413.workos.com;')
09: ('X-CF-SpamH-Score', '1')
10: ('DKIM-Signature', 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=cursor.sh;\r\n\th=content-type:from:mime-version...dfVmXxtGg==')
11: ('Received', 'by recvd-5fb76865d7-qmshh with SMTP id recvd-5fb76865d7-qmshh-1-67C13FF6-E\r\n\t2025-02-...0.739446787 +0000 UTC m=+9098610.951488543')
12: ('Received', 'from NDI1MjQ2OTQ (unknown)\r\n\tby geopod-ismtpd-canary-0 (SG)\r\n\twith HTTP\r\n\tid Jz85xBj5...\tFri, 28 Feb 2025 04:47:50.693 +0000 (UTC)')
13: ('Content-Type', 'multipart/alternative; boundary=d31ed194cx905a5e77a44')
14: ('Date', 'Fri, 28 Feb 2025 04:47:50 +0000 (UTC)')
15: ('From', 'Cursor [email protected]')
16: ('Mime-Version', '1.0')
17: ('Message-ID', 'Jz85xBj5QUmY-g8iEvgxYw@geopod-ismtpd-canary-0')
18: ('Subject', 'Verify your email address')
19: ('X-SG-EID', '=?us-ascii?Q?u001=2ELu=2FEgxNG?=...=?us-ascii?Q?89HN=2xeqk5o=3D?=')
20: ('X-SG-ID', '=?us-ascii?Q?u001=2xD?=')
21: ('To', '[email protected]')
22: ('X-Entity-ID', 'u001.Zx6FngFgyAx9A==')
23: ('X-CM-TRANSID', '_____wD3rwf4P8x9S3')
24: ('Authentication-Results', 'gzga-mx-mtada-g7-9; spf=pass smtp.mail=cfbounc\r\n\[email protected]; dkim=pass head...mail.net; dkim=p\r\n\tass [email protected]')
25: ('X-Coremail-Antispam', '1Uf129KBjDUn29KB7ZKAUJUxIYCTnIWIevJa73UjIFyTuYvjxUOwIDDUUUU')
26: ('Sender', '[email protected]')
len(): 27
The text was updated successfully, but these errors were encountered: