#!/usr/bin/env python # -*- coding: utf-8 -*- from GmailConnector import GmailConnector from GmailConnector import get_members from datetime import date if __name__ == "__main__": members = [ a["email"] for a in get_members() ] content = """ * 버즈니 점심 사전조사 * // %s 안드실분은 시간내에 답장해주세요. """ content = content % (date.today()) gc = GmailConnector() gc.send(["*****@*****.**"], "pre", content) # gc.send(members, "pre", content)
#!/usr/bin/env python # -*- coding: utf-8 -*- from GmailConnector import GmailConnector, CrawlUtil from GmailConnector import get_members from GmailConnector import get_account import random, imaplib, datetime, time if __name__ == "__main__": members = get_members() account, passwd = get_account() M = imaplib.IMAP4_SSL("imap.gmail.com", 993) print account, passwd M.login("%s" % account, "%s" % passwd) exit() M.select() typ, data = M.search(None, 'ALL') for num in data[0].split(): typ, data = M.fetch(num, '(BODY[HEADER])') email_data = data[0][1] pattern_list = [ 'Date:(?P<date>.*?) \+' , 'From:.*?<(?P<from>.*?)>' ] app_data = CrawlUtil.extractData(email_data, pattern_list)[0] today = datetime.date.today() mail_day = time.strptime(app_data['date'],"%a, %d %b %Y %H:%M:%S") if today.year == mail_day.tm_year: if today.month == mail_day.tm_mon: