R
Rybread
Real quick, I have account X and I want a python script that goes in
and looks for emails sent from Y and then to save them. i'm trying to
go off the swen killer I have listed below (which i took from someone
on this NG):
import poplib
import time
print 'Start at', time.asctime()
host = 'X'
port = 110
user = 'username'
pasw = 'password'
logfilename = 'sent_from_mobile_phone'
minsize = 130000
maxsize = 180000
fromtag = 'From user@domain %s\n'
ps = poplib.POP3(host, port)
ps.user(user)
ps.pass_(pasw)
messages = ps.list()
print '%d messages, %d bytes' % (len(messages[1]), messages[-1])
logfile = open(logfilename, 'a')
for sms in messages[1]:
sid, ssize = sms.split()
if minsize <= int(ssize) < maxsize:
message = ps.retr(sid)
print 'retrieving and deleting msg#%s, %d bytes, %d lines' % (
sid, message[-1], len(message[1]))
logfile.write(fromtag % time.asctime())
for line in message[1]:
logfile.write(line)
logfile.write("\n")
logfile.write('\n')
ps.dele(sid)
ps.quit()
print 'Done at', time.asctime()
print
and looks for emails sent from Y and then to save them. i'm trying to
go off the swen killer I have listed below (which i took from someone
on this NG):
import poplib
import time
print 'Start at', time.asctime()
host = 'X'
port = 110
user = 'username'
pasw = 'password'
logfilename = 'sent_from_mobile_phone'
minsize = 130000
maxsize = 180000
fromtag = 'From user@domain %s\n'
ps = poplib.POP3(host, port)
ps.user(user)
ps.pass_(pasw)
messages = ps.list()
print '%d messages, %d bytes' % (len(messages[1]), messages[-1])
logfile = open(logfilename, 'a')
for sms in messages[1]:
sid, ssize = sms.split()
if minsize <= int(ssize) < maxsize:
message = ps.retr(sid)
print 'retrieving and deleting msg#%s, %d bytes, %d lines' % (
sid, message[-1], len(message[1]))
logfile.write(fromtag % time.asctime())
for line in message[1]:
logfile.write(line)
logfile.write("\n")
logfile.write('\n')
ps.dele(sid)
ps.quit()
print 'Done at', time.asctime()