You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
708 B
43 lines
708 B
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
email "MY/webapp/common/email"
|
|
)
|
|
|
|
func EmailReceiver(router *email.Router) {
|
|
for {
|
|
err := router.HandleEmailRequest()
|
|
fmt.Println("EMAIL ROUTED!")
|
|
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
|
|
router, err := email.NewRouter(ctx, email.Config{
|
|
RedisHostPort: "127.0.0.1:6379",
|
|
SMTPHost: "localhost",
|
|
SMTPPort: 1025,
|
|
})
|
|
|
|
if err != nil { panic(err) }
|
|
defer router.Close()
|
|
|
|
go EmailReceiver(&router)
|
|
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
|
|
|
_ = <-c
|
|
fmt.Println("Shutdown now...")
|
|
}
|
|
|
|
|