批量检测Google账号/Gmai是否被封
目录
一、应用概述
邮箱检测器: 一个用于快速检测邮箱死活的工具
准确说,是检测邮箱的存活状态,即检测邮箱是存活的还是其他(包括死的,即被封、 不可能的、未注册的)。适用邮箱卖家或买家对邮箱质量进行检测,也适合群发邮件前对目标邮箱进行检测,增加命中率从而减少相应成本。
本邮箱检测器,目前仅支持Google邮箱/Gmail
1. Gmail邮箱
2. Google域名邮箱
2. Google域名邮箱
即将支持的邮箱
1. Yahoo邮箱
2. Outlook邮箱
3. Hotmail邮箱
4. QQ邮箱
5. 163邮箱
2. Outlook邮箱
3. Hotmail邮箱
4. QQ邮箱
5. 163邮箱
二、特色功能
- 核心:不用登陆邮箱,即可检测邮箱存活状态
- 应用轻量级,网页加载很快
- 应用开箱即用,无需进行注册
- 应用支持批量输入,进行批量检测,无检测次数限制
- 应用检测结果直观,可用于死活统计或者死号剔除等多用途
- 应用完全免费,除非不可抗因素,后期会一直维护
三、实现原理
原理是利用smtp,以下是Python代码,理论也可检测其他的国内外邮箱,比如yahoo、outlook、163、qq、yahoo邮箱,待测哦…
<span class="kwd">def</span><span class="pln"> check_by_smtp</span><span class="pun">(</span><span class="pln">gmail</span><span class="pun">):</span><span class="pln"> domain_name </span><span class="pun">=</span><span class="pln"> gmail</span><span class="pun">.</span><span class="pln">split</span><span class="pun">(</span><span class="str">'@'</span><span class="pun">)[</span><span class="lit">1</span><span class="pun">]</span><span class="pln"> records </span><span class="pun">=</span><span class="pln"> dns</span><span class="pun">.</span><span class="pln">resolver</span><span class="pun">.</span><span class="pln">resolve</span><span class="pun">(</span><span class="pln">domain_name</span><span class="pun">,</span> <span class="str">'MX'</span><span class="pun">)</span><span class="pln"> mxRecord </span><span class="pun">=</span><span class="pln"> str</span><span class="pun">(</span><span class="pln">records</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">exchange</span><span class="pun">)</span><span class="pln"> host </span><span class="pun">=</span><span class="pln"> socket</span><span class="pun">.</span><span class="pln">gethostname</span><span class="pun">()</span><span class="pln"> server </span><span class="pun">=</span><span class="pln"> smtplib</span><span class="pun">.</span><span class="pln">SMTP</span><span class="pun">()</span><span class="pln"> server</span><span class="pun">.</span><span class="pln">set_debuglevel</span><span class="pun">(</span><span class="lit">0</span><span class="pun">)</span> <span class="com"># SMTP</span><span class="pln"> server</span><span class="pun">.</span><span class="pln">connect</span><span class="pun">(</span><span class="pln">mxRecord</span><span class="pun">)</span><span class="pln"> server</span><span class="pun">.</span><span class="pln">helo</span><span class="pun">(</span><span class="pln">host</span><span class="pun">)</span><span class="pln"> server</span><span class="pun">.</span><span class="pln">mail</span><span class="pun">(</span><span class="str">'[email protected]'</span><span class="pun">)</span><span class="pln"> code</span><span class="pun">,</span><span class="pln"> message </span><span class="pun">=</span><span class="pln"> server</span><span class="pun">.</span><span class="pln">rcpt</span><span class="pun">(</span><span class="pln">str</span><span class="pun">(</span><span class="pln">gmail</span><span class="pun">))</span><span class="pln"> status </span><span class="pun">=</span> <span class="kwd">False</span> <span class="kwd">if</span><span class="pln"> code </span><span class="pun">==</span> <span class="lit">250</span><span class="pun">:</span><span class="pln"> status </span><span class="pun">=</span> <span class="kwd">True</span> <span class="kwd">return</span><span class="pln"> status</span>
参考:
1. https://flask.palletsprojects.com/en/1.1.x/patterns/jquery/
2. https://www.scottbrady91.com/Email-Verification/Python-Email-Verification-Script