mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
32 lines
625 B
Go
32 lines
625 B
Go
package controllers
|
|
|
|
import (
|
|
"github.com/jhillyerd/inbucket/app/smtpd"
|
|
"github.com/robfig/revel"
|
|
)
|
|
|
|
type Application struct {
|
|
*rev.Controller
|
|
}
|
|
|
|
func (c Application) Index() rev.Result {
|
|
return c.Render()
|
|
}
|
|
|
|
type SmtpdPlugin struct {
|
|
rev.EmptyPlugin
|
|
server *smtpd.Server
|
|
}
|
|
|
|
func (p SmtpdPlugin) OnAppStart() {
|
|
domain := rev.Config.StringDefault("smtpd.domain", "localhost")
|
|
port := rev.Config.IntDefault("smtpd.port", 2500)
|
|
rev.INFO.Printf("SMTP Daemon plugin init {domain: %v, port: %v}", domain, port)
|
|
p.server = smtpd.New(domain, port)
|
|
go p.server.Start()
|
|
}
|
|
|
|
func init() {
|
|
rev.RegisterPlugin(SmtpdPlugin{})
|
|
}
|