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.
41 lines
654 B
41 lines
654 B
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
"MY/webapp/config"
|
|
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() {
|
|
config.Load("config.json")
|
|
|
|
ctx := context.Background()
|
|
|
|
router, err := email.NewRouter(ctx)
|
|
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...")
|
|
}
|
|
|
|
|