最近刚刚处理了自己的邮件,而且是在不同的客户端之间转换,有些心得,写出来,希望可以帮到后来人.
首先要说的是选择邮件客户端.我用过三个不同的客户端,分别是Kmail,Evolution以及Thunderbird.我本人推崇用Thunderbird.原因有,这是著名Mozilla Foundation的产品(Firefox是该组织的项目),而且Thunderbird有Windows,Macintosh,Linux三个版本,使得以后更换操作系统没有后顾之忧,此外,Thunderbird的到的邮件服务器支持相对较广(Microsoft Exchange可以支持它).还有,它小巧速度相对更些.
有没有想过,你的邮件客户端是如何存储的你邮件的?
下面简单介绍下常见的邮箱格式.主要有两种
mbox. 这是Unix系统上最广泛使用的格式,所有的邮件存储在一个文件里,每一封邮件以这样的格式开始:
From twinhorse@example Fri Jan 7 13:40:22 CST 2011
maildir. 这邮箱格式,有三个子目录,分别是tmp,new,cur,每一封邮件单独放在一个文件里,文件的命名以不重复为准.
我的Kmail备份的邮箱是Maildir格式,而两个Evolution的备份文件都是mbox格式,目标客户端Thunderbird是mbox格式.
Evolution 到 Thunderbird
这个步骤相对简单
将备份的邮箱文件(Inbox 和 Sent)文件重命名后拷贝到/Users/twinhorse/Library/Thunderbird/Profiles/jjlryseu.default/Mail/Local Folders下(路径以我的mac系统为例),然后打开Thunderbird软件,你会发现多了两个邮件文件夹,这时候你可以在Thunderbird中对邮件拷贝移动,自由整理.
Kmail 到 Thunderbird
这个步骤中要用一个脚本,将Maildir格式邮箱转化为mbox格式的邮箱,脚本xfmail2mbox.sh下载,原始出处: http://userbase.kde.org/KMail/Tools#Mail_Import_Tools 在格式转换以后,步骤同 Evolution 到 Thunderbird
提取邮件脚本
有时候,你打算将信箱中所有@seu.edu.cn的邮箱发送给你的邮件都提取出来,单独存放压缩存储.或者,你打算将所有经由seu.edu.cn服务器转发给你的邮件提取出来.你可以使用我写的这个提取邮件脚本.
脚本如下
#!/bin/bash # # Extract certain mails from a mbox file. # # # # Using Scenario and Example: # When using Thunderbird or Evolution, you need to copy all the email which mail from # *@example.org to another mail folder, you can use command like this: # xmailfromBox /path/to/your/Sent /path/you/want/use/example.sent 'example.org' 1 # Another example: you have multiple email accounts, all mails stored in the same Inbox, # you now want to separate them. Firstly, try to identify some pattern of mails from # the same mail server, say, the 4th line contains '(HELO example.org)', then: # xmailfromBox /path/to/your/Inbox example.inbox '(HELO example.org)' 4 # # History: # Jan 7 2011 twinhorse # - first edition # USAGE=false if [ -z "$1" ]; then USAGE=true elif [ -z "$2" ]; then USAGE=true elif [ -z "$3" ]; then USAGE=true fi if $USAGE ; then echo "Usage: $0 input-mbox-file output-mbox-file containing-pattern [line number]" exit fi if [ -z "$4" ]; then LINENUM=1; else LINENUM=$4; fi START=1 STOP=-1 rm -f $2 while read line ; do START=$( expr $STOP + 1 ) STOP=$( expr $line - 1 ) echo "An email from line $START to line $STOP" EMAILCONTENT=$(sed -n "$START,$STOP p" $1) echo "$EMAILCONTENT" | awk "NR==$LINENUM" if [ ! -z "$(echo "$EMAILCONTENT" | awk "NR==$LINENUM" | grep "$3" )" ]; then echo "$EMAILCONTENT" >> $2 echo '' >> $2 fi done < <(perl -ne '{/^From / and print $.,"\n"}' $1) START=$( expr $STOP + 1 ) STOP=$( wc -l "$1" | cut -d ' ' -f 2 ) echo "An email from line $START to line $STOP" EMAILCONTENT=$(sed -n "$START,$STOP p" $1) echo "$EMAILCONTENT" | awk "NR==$LINENUM" if [ ! -z "$(echo "$EMAILCONTENT" | awk "NR==$LINENUM" | grep "$3" )" ]; then echo "$EMAILCONTENT" >> $2 echo '' >> $2 fi
脚本的原理是对mbox文件中的每一封邮件进行单独处理,判断其第x行是包含y这个字符串,如果包含,就提出这封邮件.
博主的文章很不错,我是站长工具-站长精灵的作者,一款专业的SEO工具软件(可以帮您提高博客的流量),想跟您交换个链接,不知可否
博主,兔年快乐!
很实用啊~~
正在考虑迁移到雷鸟,有点放不下foxmail