邮件发太多,被QQ邮箱官方给限制了,各种Send Email Failed 550 Connection frequency limited,妈的网易163邮箱也不太好使,没办法暂时两个邮箱一起上,加长时间间隔,多加几次重试,妈蛋先写出来明天跑跑不行再说,哪位大神有高招对付这种邮件发送多了受限的啊,求指教
刚发现新浪也有邮箱,明天不行再加个,话说我们这百度搜索360搜索必应搜索什么垃圾,我博客里的老文章都没有收录,谷歌一搜就出来!是禁止国内蜘蛛爬取?还是技术差距大啊!天天就寻思买广告赚流量热钱啊?NLP做的这么烂,分词分的完全不是重点好么!多少年了中文处理还做的不如谷歌!
#*-coding:utf-8-*-
import urllib2
import re
import smtplib
import time
from email.mime.text import MIMEText
retries1=5
_to = "xxxxxxxxxxxxx@360.cn"
class SendQqMail:
def getqqmail(self, retries):
_user = "xxxxxxxxxxxxx@qq.com"
_pwd = "xxxxxxxxxxxxxxxxxxxxx"
msg = MIMEText(listitem1[74:-4])
msg["Subject"] = listitem1[0:42]
msg["From"] = _user
msg["To"] = _to
try:
time.sleep(30)
s = smtplib.SMTP_SSL("smtp.qq.com", 465)
s.login(_user, _pwd)
s.sendmail(_user, _to, msg.as_string())
s.quit()
print "Send QQ Email Success!"
except smtplib.SMTPException, e:
print "retry.QQ mail.........,%s" % e
if retries > 0:
return self.getqqmail(retries - 1)
else:
print "Send QQ Email Falied,%s" % e
class Send163Mail:
def get163mail(self, retries):
_user = "xxxxxxxxxxxxxxx@163.com"
_pwd = "xxxxxxxxxxxxxxxxxxx"
msg = MIMEText(listitem1[74:-4])
msg["Subject"] = listitem1[0:42]
msg["From"] = _user
msg["To"] = _to
try:
time.sleep(30)
s = smtplib.SMTP_SSL("smtp.163.com", 465)
s.login(_user, _pwd)
s.sendmail(_user, _to, msg.as_string())
s.quit()
print "Send 163 Email Success!"
except smtplib.SMTPException, e:
print "retry.163mail..........,%s" % e
if retries > 0:
return self.get163mail(retries - 1)
else:
print "Send 163 Email Falied,%s" % e
request = urllib2.Request("http://bbs.360.cn/forum-175-1.html")
response = urllib2.urlopen(request)
buffer = response.read()
getarticlelist = re.compile(r'http://bbs.360.cn/thread-.+-1-1.html" \s?target="_blank" class="s xst".*\s*</a>')
pagemsg = re.findall(getarticlelist,buffer)
print "system start"
while True:
time.sleep(5)
request1 = urllib2.Request("http://bbs.360.cn/forum-175-1.html")
response1 = urllib2.urlopen(request1)
buffer1 = response1.read()
getarticlelist1 = re.compile(r'http://bbs.360.cn/thread-.+-1-1.html" \s?target="_blank" class="s xst".*\s*</a>')
pagemsg1 = re.findall(getarticlelist1,buffer1)
for listitem1 in pagemsg1:
if listitem1 in pagemsg:
pass
else:
pagemsg.append(listitem1)
try:
qqsendmailer = SendQqMail()
time.sleep(60)
qqsendmailer.getqqmail(10)
except:
print "QQ mail try five times fail,change 163mail"
neteasysendmailer = Send163Mail()
time.sleep(60)
neteasysendmailer.get163mail(10)