1
0
mirror of https://github.com/mgerb/tmail synced 2026-01-09 01:12:47 +00:00

minor updates

This commit is contained in:
2018-02-06 15:00:31 +00:00
parent a6af3d11e2
commit b626050b5f
6 changed files with 25 additions and 13 deletions

4
Gopkg.lock generated
View File

@@ -79,7 +79,7 @@
"unix", "unix",
"windows" "windows"
] ]
revision = "8f27ce8a604014414f8dfffc25cbcde83a3f2216" revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd"
[[projects]] [[projects]]
name = "gopkg.in/go-playground/validator.v8" name = "gopkg.in/go-playground/validator.v8"
@@ -96,6 +96,6 @@
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "466f07b37f7df05f3425d1710259c615b219c5ebb3bd49dfaa4a1d5520a3804c" inputs-digest = "9f37329612da4c0d5506ae252d26615db7c9e6cbe5c05a7ced8868957d1ef5b7"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@@ -25,10 +25,22 @@
# unused-packages = true # unused-packages = true
[[constraint]]
name = "github.com/asdine/storm"
version = "2.0.2"
[[constraint]]
name = "github.com/gin-gonic/gin"
version = "1.2.0"
[[constraint]] [[constraint]]
branch = "master" branch = "master"
name = "github.com/mhale/smtpd" name = "github.com/mhale/smtpd"
[[constraint]]
name = "github.com/sirupsen/logrus"
version = "1.0.4"
[prune] [prune]
go-tests = true go-tests = true
unused-packages = true unused-packages = true

View File

@@ -1,9 +1,8 @@
package db package db
import ( import (
"log"
"github.com/asdine/storm" "github.com/asdine/storm"
log "github.com/sirupsen/logrus"
) )
var Conn *storm.DB var Conn *storm.DB

View File

@@ -3,16 +3,12 @@ package main
import ( import (
"os" "os"
"github.com/asdine/storm"
"github.com/mgerb/tmail/db" "github.com/mgerb/tmail/db"
"github.com/mgerb/tmail/smtpserver" "github.com/mgerb/tmail/smtpserver"
"github.com/mgerb/tmail/webserver" "github.com/mgerb/tmail/webserver"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
//DB - database instance
var DB *storm.DB
func init() { func init() {
// Log as JSON instead of the default ASCII formatter. // Log as JSON instead of the default ASCII formatter.
log.SetFormatter(&log.JSONFormatter{}) log.SetFormatter(&log.JSONFormatter{})

View File

@@ -1,8 +1,12 @@
# TMail # TMail
A throwaway smtp mail server. A throwaway smtp mail server with an API to retrieve emails.
- set up an MX record on your domain.
- point it at your server
- start tmail
- all emails sent to *@<your domain> are stored in `mail.db`
- hit these end points to check the email
## Check email
``` ```
All mail: All mail:
http://host:8090/api/mail http://host:8090/api/mail

View File

@@ -1,11 +1,11 @@
package webserver package webserver
import ( import (
"log"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/mgerb/tmail/db" "github.com/mgerb/tmail/db"
"github.com/mgerb/tmail/mail" "github.com/mgerb/tmail/mail"
log "github.com/sirupsen/logrus"
) )
func Start() { func Start() {
@@ -18,7 +18,8 @@ func mailHander(c *gin.Context) {
to := c.Query("to") to := c.Query("to")
var mail []mail.Mail var mail []mail.Mail
log.Println(to)
log.Debug(to)
if to != "" { if to != "" {
db.Conn.Find("To", to, &mail) db.Conn.Find("To", to, &mail)