mirror of https://github.com/carlostrub/sisyphus
get lists of mail keys
parent
f2e326313b
commit
46e554e188
@ -1,4 +1,6 @@
|
|||||||
hash: e01a94e522ffe651c39d713d40e62bf312605f2504949b92a96797dab5faf2f3
|
hash: 0fbdb475136d5d29feb99b15dafd533580a8bbbf4fcfd801ddeeeb24e9a840c0
|
||||||
updated: 2017-02-20T22:22:08.238892736Z
|
updated: 2017-02-20T22:35:31.503897743Z
|
||||||
imports: []
|
imports:
|
||||||
|
- name: github.com/luksen/maildir
|
||||||
|
version: 5297d9c3091c7d4891c9d4f6fa743d500c038d6f
|
||||||
testImports: []
|
testImports: []
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
package: github.com/carlostrub/sisyphus
|
package: github.com/carlostrub/sisyphus
|
||||||
import: []
|
import:
|
||||||
|
- package: github.com/luksen/maildir
|
||||||
|
@ -1,9 +1,42 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
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() {
|
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…
Reference in New Issue