Advertisement
metalx1000

Mail Archiver

Sep 11th, 2015
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.66 KB | None | 0 0
  1. #!/bin/bash
  2. #Script By Kris Occhipinti
  3. #GPLv3 September 11, 2015
  4.  
  5. dir="$HOME/mail/<domain>/<mbox>/new/"
  6.  
  7. for i in "`ls ${dir}*`"
  8. do
  9.   pid="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
  10.   address="$(grep "^Cc:" "$i"|grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b")"
  11.   name="$(grep "^From:" "$i"|sed 's/ via /:/g'|cut -d\: -f2|sed "s/^[ \t]*//")"
  12.   subject="$(grep '^Subject: \[Members\] ' "$i"|sed 's/Subject: \[Members\] //g')"
  13.   body="$(sed '/Sender: "Members" /,/_____________________________/!d' "$i"|sed '1d; 2d; $d')"
  14.   date="$(grep "^Date: " "$i"|cut -d\: -f2|sed "s/^[ \t]*//")"
  15.   timestamp="$(date +%s)000"
  16. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement