Esempio n. 1
0
func handler(peer smtpd.Peer, env smtpd.Envelope) error {
	filename := archiver.Archive(env.Data)

	if viper.GetBool("save_vars") {
		archiver.SaveVars(peer, env, filename)
	}

	if viper.GetBool("reinject") {
		reinject(env)
	}

	return nil
}
func Archive(data []byte) string {
	if viper.GetBool("compress") {
		data = compress(data)
	}
	filename := viper.GetString("object_prefix") + time.Now().Format(viper.GetString("filename_time_format")) + "_" + utils.RandomString(3)

	transfer(data, filename)

	return filename
}