|
|
|
@ -4,8 +4,14 @@ import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"log"
|
|
|
|
|
"net"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
ZangSmtpServer.HandlerRcpt = handlerRcpt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func mailHandler(origin net.Addr, from string, to []string, data []byte) {
|
|
|
|
|
SmtpSession := new(Session)
|
|
|
|
|
|
|
|
|
@ -28,3 +34,20 @@ func mailHandler(origin net.Addr, from string, to []string, data []byte) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func handlerRcpt(remoteAddr net.Addr, from string, to string) bool {
|
|
|
|
|
|
|
|
|
|
log.Println("CHECK #2 Rcpt to:", to)
|
|
|
|
|
if !SmtpBackend.CheckValidRcpt(to) {
|
|
|
|
|
log.Printf("%s [ %s -> $s ] %s BAD!!!!", "YU NO MAIL!!! WE NU RELAY!!! ", from, to, remoteAddr.String() )
|
|
|
|
|
time.Sleep(10 * time.Second)
|
|
|
|
|
return false
|
|
|
|
|
}else{
|
|
|
|
|
log.Printf("%s [ %s -> $s ] %s GOOD!!!!", "WE DO!!!", from, to, remoteAddr.String() )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|