Added mock mail client.
This commit is contained in:
parent
869c507737
commit
d0caa8119e
3 changed files with 48 additions and 0 deletions
27
mail/mail.go
Normal file
27
mail/mail.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package mail
|
||||
|
||||
import (
|
||||
"goweb/config"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
func NewClient(cfg *config.Config) (*Client, error) {
|
||||
return &Client{
|
||||
config: cfg,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Client) Send(ctx echo.Context, to, body string) error {
|
||||
if c.config.App.Environment != config.EnvProduction {
|
||||
// IE, skip sending email..
|
||||
}
|
||||
ctx.Logger().Debugf("Mock email sent. To: %s Body: %s", to, body)
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: Send with template?
|
||||
Loading…
Add table
Add a link
Reference in a new issue