查看單個文章
舊 2004-07-01, 01:58 AM   #3 (permalink)
psac
榮譽會員
 
psac 的頭像
榮譽勳章
UID - 3662
在線等級: 級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時級別:30 | 在線時長:1048小時 | 升級還需:37小時
註冊日期: 2002-12-07
住址: 木柵市立動物園
文章: 17381
現金: 5253 金幣
資產: 33853 金幣
預設

Gmail工具大匯總

隨著 Gmail的用戶越來越多,針對Gmail的小工具也越來越多。下面總結了一些


Gmail POP 工具 推薦
Pop Goes the GMail

http://www.neowin.net/forum/index.php?showtopic=169789

Lets you access your GMail account with a POP3 mail client.
PGtGM sits between you GMail account and your email client, converting messages from the web based mailbox into POP3 messages that a program such as Outlook Express or Firebird can understand.

Gmail Tray
GTray
Lives in your system tray and alerts you to pending GMails.
http://torrez.us/archives/2004/05/23/000272.html


Forward Hotmail to Gmail
GetMail 推薦
http://www.e-eeasy.com/GetMail.aspx


Auto-Forwards Hotmail messages to GMail

http://www.marklyon.org/gmail/default.htm
這個是Hotmail用戶的福音,很好用,我用這個工具forward了110個Hotmail email到Gmail


Google GMail Loader (GML)
Import your existing email into GMail!
注意:這個工具不支持Outlook/Outlook Express,只支持mBox
另外,我一直也沒有試驗成功!估計是smtp 的問題


用gmail存儲照片或者其他內容 - lyh728
lyh的帖子

用gmail存儲照片或者其他內容

參照網上的gml ,我寫了一個python的指令碼,
可以直接把一個目錄的文件一封信一封信的直接傳送到gmail的郵箱
標題就是文件在目錄中的相對的名字
為什麼不用其他的email客戶端呢
1 指令碼可以批次處理,每個照片文件當作一個mail
2 直接通過gmail的 smtp的server ,不容易被拒收

把下面的程式碼存為smail.py,需要安裝python2.3
我在 win2k3下測試通過
直接加參數 -h 就是說明

可以使用其他的smtp ,也可以傳送到其他的email server,支持smtp的認證

指令碼的好處就是公開,不需要擔心安全問題
程式碼:


COMMASPACE = ', '

def usage(code, msg=''):
#print >> sys.stderr, __doc__
#if msg: print >> sys.stderr, msg
print 'Usage: smail [-Options]'\
' "sender email address" "receiver email address" \n'
print '\t-h --help , Help Screen'
print '\t-d --directory path ,the files or the file directory to send'
print '\t-l --list listfile name, The file list to send ,just like m3u list'
print '\t-u --user username , the username for autherized smtp server'
print '\t-p --password password , the password for autherized smtp server'
print '\t-s --smtp server,Optional SMTP Server ,eg. gsmtp171.google.com,gsmtp57.google.com'
print 'Exmpl: smail -h '
print 'Exmpl: smail -d test.jpg sender@mail.com recipt@gmail.com '
print 'Exmpl: smail -s gsmtp171.google.com sender@mail.com recipt@gmail.com '
print 'Exmpl: smail -l mp3list.m3u -s smtp.sohu.com -u sender -p password sender@sohu.com recipt@gmail.com '
sys.exit(code)
def relativepath(dir,path):
pdir = os.path.abspath(dir)
rpath=os.path.abspath(path)[len(pdir)+1:]
return rpath

def mkmimemail(path,descript,sender,recips):
# Create the enclosing (outer) message
# Guess the content type based on the file's extension. Encoding
# will be ignored, although we should check for simple things like
# gzip'd or compressed files.
ctype, encoding = mimetypes.guess_type(path)
if ctype is None or encoding is not None:
# No guess could be made, or the file is encoded (compressed), so
# use a generic bag-of-bits type.
ctype = 'application/octet-stream'
maintype, subtype = ctype.split('/', 1)
if maintype == 'text':
fp = open(path)
# Note: we should handle calculating the charset
msg = MIMEText(fp.read(), _subtype=subtype)
fp.close()
elif maintype == 'image':
fp = open(path, 'rb')
msg = MIMEImage(fp.read(), _subtype=subtype)
fp.close()
elif maintype == 'audio':
fp = open(path, 'rb')
msg = MIMEAudio(fp.read(), _subtype=subtype)
fp.close()
else:
fp = open(path, 'rb')
msg = MIMEBase(maintype, subtype)
msg.set_payload(fp.read())
fp.close()
# Encode the payload using Base64
Encoders.encode_base64(msg)
# Set the filename parameter
head,filename=os.path.split(path)
utf8filename=str(Header(unicode(filename,'mbcs' )))
msg.add_header('Content-Disposition', 'attachment', filename=utf8filename)

outer = MIMEMultipart()
outer['Subject'] = Header(unicode(descript,'mbcs'))
outer['To'] = COMMASPACE.join(recips)
outer['From'] = sender
outer.preamble = 'You will not see this in a MIME-aware mail reader.\n'
# To guarantee the message ends with a newline
outer.epilogue = ''
filenameContent=unicode(descript,'mbcs').encode('utf8')
filenamemsg=MIMEText(filenameContent, _subtype='plain',_charset='UTF-8')
outer.attach(filenamemsg)
outer.attach(msg)
#print filename,utf8filename
return outer
def mysendmail(outermsg,smtpserver_in,sender, recips,username,password):
time.sleep(2)
s = smtplib.SMTP(smtpserver_in)
if (username !='') :
try:
s.login(username,password)
except:
pass
s.sendmail(sender, recips, outermsg.as_string())
s.close()
def sendafile(path,descript,smtpserver_in,sender,recips,username,password):
global errorlogfile
outermsg=mkmimemail(path,descript,sender,recips)
# Now send the message

try:
mysendmail(outermsg,smtpserver_in,sender, recips,username,password)
print " Success Send a message for file : %s" % path
#break
except smtplib.SMTPRecipientsRefused:
#SMTPSenderRefused
print " Receiver Refused %s " % recips
print " Failed Send file : %s " % path
errorlogfile.write(os.path.abspath(path)+'\n')
#errorlogfile.write('\n')
return
except:
print " Failed Send file : %s " % path
errorlogfile.write(os.path.abspath(path)+'\n')
#errorlogfile.write('\n')
#if count>=5:
#print "\n ERROR SENDING MESSAGE for file : %s" % rpathname
def senddirfiles(maindir,dir,smtpserver_in,sender,recips,username,password):
for filename in os.listdir(dir):
path = os.path.join(dir, filename)
if not os.path.isfile(path):
senddirfiles(maindir,path,smtpserver_in,sender, recips,username,password)
continue
rpathname=relativepath(maindir,path)
sendafile(path,rpathname,smtpserver_in,sender,recips,username,password)

def sendfiles(dir,smtpserver_in,sender,recips,username,password):
if not os.path.isfile(dir):
senddirfiles(dir,dir,smtpserver_in,sender,recips,username,password)
elif os.path.isfile(dir):
head,filename=os.path.split(dir)
sendafile(dir,filename,smtpserver_in,sender,recips,username,password)

def main():
global errorlogfile
locale.setlocale(locale.LC_ALL, '')
errorlogfile=file("sendfail.m3u",'w')
try:
opts, args = getopt.getopt(sys.argv[1:], 'hd:s:u:l:', ['help', 'directory=','smtp','user','password','list'])
except getopt.error, msg:
usage(1, msg)

smtpserver_in = 'gsmtp57.google.com'
username = ''
password = ''

dir = os.curdir
dirs=[]
for opt, arg in opts:
if opt in ('-h', '--help'):
usage(0)
elif opt in ('-d', '--directory'):
dir = ''
dirs=dirs+[arg]

elif opt in ('-s','--smtp'):
smtpserver_in= arg
elif opt in ('-u','user'):
username= arg
elif opt in ('-p','password'):
password= arg
elif opt in ('-l','list'):
listfile=file(arg,'r',0)
dirs=dirs+listfile.readlines()
listfile.close()
dir = ''


if len(args) < 2:
usage(1)

sender = args[0]
recips = args[1:]
print 'sender ',sender
print 'recipers :',recips
print 'smtp server:',smtpserver_in
if dir!='':
dirs= [dir]
for dir in dirs:
dir=dir.strip()
if dir=='':continue
print "\n Now Handle the Path: %s" % dir
sendfiles(dir,smtpserver_in,sender,recips,username,password)

errorlogfile.close()



if __name__ == '__main__':
main()



-------------------------------------------------------------------------------------
UoKo的關於如何使用Gmail Label的文章非常好,建議閱讀
UoKo的帖子上面一篇..(用好Gmail標籤使用 )
__________________
http://bbsimg.qianlong.com/upload/01/08/29/68/1082968_1136014649812.gif
psac 目前離線  
送花文章: 3, 收花文章: 1631 篇, 收花: 3205 次