get lists of mail keys

master
Carlo Strub 7 years ago
parent f2e326313b
commit 46e554e188

8
glide.lock generated

@ -1,4 +1,6 @@
hash: e01a94e522ffe651c39d713d40e62bf312605f2504949b92a96797dab5faf2f3
updated: 2017-02-20T22:22:08.238892736Z
imports: []
hash: 0fbdb475136d5d29feb99b15dafd533580a8bbbf4fcfd801ddeeeb24e9a840c0
updated: 2017-02-20T22:35:31.503897743Z
imports:
- name: github.com/luksen/maildir
version: 5297d9c3091c7d4891c9d4f6fa743d500c038d6f
testImports: []

@ -1,2 +1,3 @@
package: github.com/carlostrub/sisyphus
import: []
import:
- package: github.com/luksen/maildir

@ -1,9 +1,42 @@
package main
import (
"github.com/spf13/viper"
"fmt"
"log"
"github.com/luksen/maildir"
)
var (
// Maildirs holds a set of mail directories to handle.
Maildirs []string
)
func main() {
viper.SetConfigName("sisyphus")
Maildirs = []string{"/usr/home/cs/Maildir.TEST"}
var err error
var Bad, Good []string
for _, dir := range Maildirs {
var keysBad, keysGood []string
keysBad, err = maildir.Dir(dir + "/.Junk").Keys()
if err != nil {
log.Fatal(err)
}
Bad = append(Bad, keysBad...)
keysGood, err = maildir.Dir(dir).Keys()
if err != nil {
log.Fatal(err)
}
Good = append(Good, keysGood...)
}
fmt.Println("Bad guys:")
fmt.Println(Bad)
fmt.Println("Good guys:")
fmt.Println(Good)
}

Loading…
Cancel
Save