Open platform to collect and prioritize feedback
design: better email layout (#485)
Guilherme Oenningc33b98591cb5
diff --git a/app/actions/signin_test.go b/app/actions/signin_test.goindex a5634d86a..b881a2dde 100644--- a/app/actions/signin_test.go+++ b/app/actions/signin_test.go@@ -66,7 +66,7 @@ func TestCompleteProfile_ValidKey(t *testing.T) {RegisterT(t)e := &models.SignInByEmail{Email: "[email protected]"}- services.Tenants.SaveVerificationKey("1234567890", 15*time.Minute, e)+ services.Tenants.SaveVerificationKey("1234567890", 30*time.Minute, e)action := actions.CompleteProfile{Model: &models.CompleteProfile{Name: "Jon Snow", Key: "1234567890"}}result := action.Validate(nil, services)@@ -78,7 +78,7 @@ func TestCompleteProfile_UserInvitation_ValidKey(t *testing.T) {RegisterT(t)e := &models.UserInvitation{Email: "[email protected]"}- services.Tenants.SaveVerificationKey("1234567890", 15*time.Minute, e)+ services.Tenants.SaveVerificationKey("1234567890", 30*time.Minute, e)action := actions.CompleteProfile{Model: &models.CompleteProfile{Name: "Jon Snow", Key: "1234567890"}}result := action.Validate(nil, services)diff --git a/app/handlers/apiv1/invite.go b/app/handlers/apiv1/invite.goindex b6b17f6eb..09d8ebe8e 100644--- a/app/handlers/apiv1/invite.go+++ b/app/handlers/apiv1/invite.go@@ -25,7 +25,7 @@ func SendSampleInvite() web.HandlerFunc {"subject": input.Model.Subject,"message": markdown.Parse(input.Model.Message),})- err := c.Services().Emailer.Send(c.Tenant(), "invite_email", email.Params{}, c.Tenant().Name, to)+ err := c.Services().Emailer.Send(c, "invite_email", email.Params{}, c.Tenant().Name, to)if err != nil {return c.Failure(err)}diff --git a/app/handlers/signin.go b/app/handlers/signin.goindex b0245d92a..7a25bf26e 100644--- a/app/handlers/signin.go+++ b/app/handlers/signin.go@@ -44,7 +44,7 @@ func SignInByEmail() web.HandlerFunc {return c.HandleValidation(result)}- err := c.Services().Tenants.SaveVerificationKey(input.Model.VerificationKey, 15*time.Minute, input.Model)+ err := c.Services().Tenants.SaveVerificationKey(input.Model.VerificationKey, 30*time.Minute, input.Model)if err != nil {return c.Failure(err)}diff --git a/app/pkg/email/email.go b/app/pkg/email/email.goindex 6dd090311..56d172ebc 100644--- a/app/pkg/email/email.go+++ b/app/pkg/email/email.go@@ -29,8 +29,10 @@ type Message struct {Body string}+var baseTpl, _ = template.ParseFiles(env.Path("/views/templates/base_email.tpl"))+// RenderMessage returns the HTML of an email based on template and params-func RenderMessage(templateName string, params Params) *Message {+func RenderMessage(ctx Context, templateName string, params Params) *Message {tpl, ok := cache[templateName]if !ok || env.IsDevelopment() {var err error@@ -43,14 +45,38 @@ func RenderMessage(templateName string, params Params) *Message {}var bf bytes.Buffer- tpl.Execute(&bf, params)+ if err := tpl.Execute(&bf, params); err != nil {+ panic(err)+ }+lines := strings.Split(bf.String(), "\n")+ body := strings.TrimLeft(strings.Join(lines[2:], "\n"), " ")++ logo, ok := params["logo"].(string)+ if !ok || logo == "" {+ logo = ctx.LogoURL()+ }++ bf.Reset()+ if err := baseTpl.Execute(&bf, Params{+ "logo": logo,+ "body": template.HTML(body),+ }); err != nil {+ panic(err)+ }+return &Message{Subject: strings.TrimLeft(lines[0], "subject: "),- Body: strings.TrimLeft(strings.Join(lines[2:], "\n"), " "),+ Body: bf.String(),}}+// Context holds everything emailers need to know about execution context+type Context interface {+ Tenant() *models.Tenant+ LogoURL() string+}+// NoReply is the default 'from' addressvar NoReply = env.MustGet("EMAIL_NOREPLY")@@ -92,6 +118,6 @@ func CanSendTo(address string) bool {// Sender is used to send emailstype Sender interface {- Send(tenant *models.Tenant, templateName string, params Params, from string, to Recipient) error- BatchSend(tenant *models.Tenant, templateName string, params Params, from string, to []Recipient) error+ Send(ctx Context, templateName string, params Params, from string, to Recipient) error+ BatchSend(ctx Context, templateName string, params Params, from string, to []Recipient) error}diff --git a/app/pkg/email/email_test.go b/app/pkg/email/email_test.goindex 1c0ea00b9..7e7e3dc88 100644--- a/app/pkg/email/email_test.go+++ b/app/pkg/email/email_test.go@@ -3,6 +3,9 @@ package email_testimport ("testing"+ "github.com/getfider/fider/app/pkg/log/noop"+ "github.com/getfider/fider/app/pkg/worker"+"github.com/getfider/fider/app/pkg/email". "github.com/getfider/fider/app/pkg/assert"@@ -11,11 +14,42 @@ import (func TestRenderMessage(t *testing.T) {RegisterT(t)- message := email.RenderMessage("echo_test", email.Params{+ ctx := worker.NewContext("ID-1", "TaskName", nil, noop.NewLogger())+ message := email.RenderMessage(ctx, "echo_test", email.Params{"name": "Fider",})Expect(message.Subject).Equals("Message to: Fider")- Expect(message.Body).Equals("Hello World Fider!")+ Expect(message.Body).Equals(`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<html>+ <head>+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">+ <meta name="viewport" content="width=device-width">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ </head>+ <body bgcolor="#F7F7F7" style="font-size:16px">+ <table width="100%" bgcolor="#F7F7F7" cellpadding="0" cellspacing="0" border="0" style="text-align:center;font-size:14px;">+ <tr>+ <td height="40"> </td>+ </tr>++ <tr>+ <td align="center">+ <table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">+ Hello World Fider!+ </table>+ </td>+ </tr>+ <tr>+ <td>+ <span style="color:#666;font-size:11px">This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message.</span>+ </td>+ </tr>+ <tr>+ <td height="40"> </td>+ </tr>+ </table>+ </body>+</html>`)}func TestEmailWhitelist_Valid(t *testing.T) {diff --git a/app/pkg/email/mailgun/mailgun.go b/app/pkg/email/mailgun/mailgun.goindex 587cf2707..7cb11f9db 100644--- a/app/pkg/email/mailgun/mailgun.go+++ b/app/pkg/email/mailgun/mailgun.go@@ -7,7 +7,6 @@ import ("net/url""strings"- "github.com/getfider/fider/app/models""github.com/getfider/fider/app/pkg/email""github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/pkg/errors"@@ -31,12 +30,12 @@ func NewSender(logger log.Logger, client web.Client, domain, apiKey string) *Sen}//Send an email-func (s *Sender) Send(tenant *models.Tenant, templateName string, params email.Params, from string, to email.Recipient) error {- return s.BatchSend(tenant, templateName, params, from, []email.Recipient{to})+func (s *Sender) Send(ctx email.Context, templateName string, params email.Params, from string, to email.Recipient) error {+ return s.BatchSend(ctx, templateName, params, from, []email.Recipient{to})}// BatchSend an email to multiple recipients-func (s *Sender) BatchSend(tenant *models.Tenant, templateName string, params email.Params, from string, to []email.Recipient) error {+func (s *Sender) BatchSend(ctx email.Context, templateName string, params email.Params, from string, to []email.Recipient) error {if len(to) == 0 {return nil}@@ -49,19 +48,20 @@ func (s *Sender) BatchSend(tenant *models.Tenant, templateName string, params emfor k := range to[0].Params {params[k] = fmt.Sprintf("%%recipient.%s%%", k)}- message = email.RenderMessage(templateName, params)+ message = email.RenderMessage(ctx, templateName, params)} else {- message = email.RenderMessage(templateName, params.Merge(to[0].Params))+ message = email.RenderMessage(ctx, templateName, params.Merge(to[0].Params))}form := url.Values{}form.Add("from", fmt.Sprintf("%s <%s>", from, email.NoReply))+ form.Add("h:Reply-To", email.NoReply)form.Add("subject", message.Subject)form.Add("html", message.Body)form.Add("o:tag", fmt.Sprintf("template:%s", templateName))- if tenant != nil && !env.IsSingleHostMode() {- form.Add("o:tag", fmt.Sprintf("tenant:%s", tenant.Subdomain))+ if ctx.Tenant() != nil && !env.IsSingleHostMode() {+ form.Add("o:tag", fmt.Sprintf("tenant:%s", ctx.Tenant().Subdomain))}// Set Mailgun's var based on each recipient's variablesdiff --git a/app/pkg/email/mailgun/mailgun_test.go b/app/pkg/email/mailgun/mailgun_test.goindex 104cc9708..bfc2ce703 100644--- a/app/pkg/email/mailgun/mailgun_test.go+++ b/app/pkg/email/mailgun/mailgun_test.go@@ -6,6 +6,8 @@ import ("os""testing"+ "github.com/getfider/fider/app/pkg/worker"+"github.com/getfider/fider/app/models""github.com/getfider/fider/app/pkg/email""github.com/getfider/fider/app/pkg/mock"@@ -16,11 +18,17 @@ import (. "github.com/getfider/fider/app/pkg/assert")+var logger = noop.NewLogger()var client = mock.NewHTTPClient()-var sender = mailgun.NewSender(noop.NewLogger(), client, "mydomain.com", "mys3cr3tk3y")+var sender = mailgun.NewSender(logger, client, "mydomain.com", "mys3cr3tk3y")var tenant = &models.Tenant{Subdomain: "got",}+var ctx = worker.NewContext("ID-1", "TaskName", nil, logger)++func init() {+ ctx.SetTenant(tenant)+}func TestSend_Success(t *testing.T) {RegisterT(t)@@ -31,7 +39,7 @@ func TestSend_Success(t *testing.T) {Name: "Jon Sow",Address: "[email protected]",}- sender.Send(tenant, "echo_test", email.Params{+ sender.Send(ctx, "echo_test", email.Params{"name": "Hello",}, "Fider Test", to)@@ -44,13 +52,44 @@ func TestSend_Success(t *testing.T) {Expect(err).IsNil()values, err := url.ParseQuery(string(bytes))Expect(err).IsNil()- Expect(values).HasLen(5)+ Expect(values).HasLen(6)Expect(values.Get("to")).Equals("Jon Sow <[email protected]>")Expect(values.Get("from")).Equals("Fider Test <[email protected]>")+ Expect(values.Get("h:Reply-To")).Equals("[email protected]")Expect(values.Get("subject")).Equals("Message to: Hello")- Expect(values.Get("html")).Equals("Hello World Hello!")Expect(values["o:tag"][0]).Equals("template:echo_test")Expect(values["o:tag"][1]).Equals("tenant:got")+ Expect(values.Get("html")).Equals(`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<html>+ <head>+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">+ <meta name="viewport" content="width=device-width">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ </head>+ <body bgcolor="#F7F7F7" style="font-size:16px">+ <table width="100%" bgcolor="#F7F7F7" cellpadding="0" cellspacing="0" border="0" style="text-align:center;font-size:14px;">+ <tr>+ <td height="40"> </td>+ </tr>++ <tr>+ <td align="center">+ <table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">+ Hello World Hello!+ </table>+ </td>+ </tr>+ <tr>+ <td>+ <span style="color:#666;font-size:11px">This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message.</span>+ </td>+ </tr>+ <tr>+ <td height="40"> </td>+ </tr>+ </table>+ </body>+</html>`)}func TestSend_SkipEmptyAddress(t *testing.T) {@@ -61,7 +100,7 @@ func TestSend_SkipEmptyAddress(t *testing.T) {Name: "Jon Sow",Address: "",}- sender.Send(tenant, "echo_test", email.Params{+ sender.Send(ctx, "echo_test", email.Params{"name": "Hello",}, "Fider Test", to)@@ -77,7 +116,7 @@ func TestSend_SkipUnlistedAddress(t *testing.T) {Name: "Jon Sow",Address: "[email protected]",}- sender.Send(tenant, "echo_test", email.Params{+ sender.Send(ctx, "echo_test", email.Params{"name": "Hello",}, "Fider Test", to)@@ -105,7 +144,7 @@ func TestBatch_Success(t *testing.T) {},},}- sender.BatchSend(tenant, "echo_test", email.Params{}, "Fider Test", to)+ sender.BatchSend(ctx, "echo_test", email.Params{}, "Fider Test", to)Expect(client.Requests).HasLen(1)Expect(client.Requests[0].URL.String()).Equals("https://api.mailgun.net/v3/mydomain.com/messages")@@ -116,15 +155,46 @@ func TestBatch_Success(t *testing.T) {Expect(err).IsNil()values, err := url.ParseQuery(string(bytes))Expect(err).IsNil()- Expect(values).HasLen(6)+ Expect(values).HasLen(7)Expect(values["to"]).HasLen(2)Expect(values["to"][0]).Equals("Jon Sow <[email protected]>")Expect(values["to"][1]).Equals("Arya Stark <[email protected]>")Expect(values.Get("from")).Equals("Fider Test <[email protected]>")+ Expect(values.Get("h:Reply-To")).Equals("[email protected]")Expect(values.Get("subject")).Equals("Message to: %recipient.name%")- Expect(values.Get("html")).Equals("Hello World %recipient.name%!")Expect(values["o:tag"]).HasLen(2)Expect(values["o:tag"][0]).Equals("template:echo_test")Expect(values["o:tag"][1]).Equals("tenant:got")Expect(values.Get("recipient-variables")).Equals("{\"[email protected]\":{\"name\":\"Arya\"},\"[email protected]\":{\"name\":\"Jon\"}}")+ Expect(values.Get("html")).Equals(`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<html>+ <head>+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">+ <meta name="viewport" content="width=device-width">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ </head>+ <body bgcolor="#F7F7F7" style="font-size:16px">+ <table width="100%" bgcolor="#F7F7F7" cellpadding="0" cellspacing="0" border="0" style="text-align:center;font-size:14px;">+ <tr>+ <td height="40"> </td>+ </tr>++ <tr>+ <td align="center">+ <table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">+ Hello World %recipient.name%!+ </table>+ </td>+ </tr>+ <tr>+ <td>+ <span style="color:#666;font-size:11px">This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message.</span>+ </td>+ </tr>+ <tr>+ <td height="40"> </td>+ </tr>+ </table>+ </body>+</html>`)}diff --git a/app/pkg/email/noop/noop.go b/app/pkg/email/noop/noop.goindex 11a406aba..eba3407e6 100644--- a/app/pkg/email/noop/noop.go+++ b/app/pkg/email/noop/noop.go@@ -1,12 +1,11 @@package noopimport (- "github.com/getfider/fider/app/models""github.com/getfider/fider/app/pkg/email")type request struct {- Tenant *models.Tenant+ Context email.ContextTemplateName stringParams email.ParamsFrom string@@ -26,9 +25,9 @@ func NewSender() *Sender {}// Send an email-func (s *Sender) Send(tenant *models.Tenant, templateName string, params email.Params, from string, to email.Recipient) error {+func (s *Sender) Send(ctx email.Context, templateName string, params email.Params, from string, to email.Recipient) error {s.Requests = append(s.Requests, &request{- Tenant: tenant,+ Context: ctx,TemplateName: templateName,Params: params,From: from,@@ -39,10 +38,10 @@ func (s *Sender) Send(tenant *models.Tenant, templateName string, params email.P}// BatchSend an email to multiple recipients-func (s *Sender) BatchSend(tenant *models.Tenant, templateName string, params email.Params, from string, to []email.Recipient) error {+func (s *Sender) BatchSend(ctx email.Context, templateName string, params email.Params, from string, to []email.Recipient) error {if len(to) > 0 {s.Requests = append(s.Requests, &request{- Tenant: tenant,+ Context: ctx,TemplateName: templateName,Params: params,From: from,diff --git a/app/pkg/email/smtp/smtp.go b/app/pkg/email/smtp/smtp.goindex 9ec6bba54..c1329079d 100644--- a/app/pkg/email/smtp/smtp.go+++ b/app/pkg/email/smtp/smtp.go@@ -4,7 +4,6 @@ import ("fmt"gosmtp "net/smtp"- "github.com/getfider/fider/app/models""github.com/getfider/fider/app/pkg/email""github.com/getfider/fider/app/pkg/errors""github.com/getfider/fider/app/pkg/log"@@ -54,7 +53,7 @@ func (s *Sender) ReplaceSend(send func(string, gosmtp.Auth, string, []string, []}//Send an email-func (s *Sender) Send(tenant *models.Tenant, templateName string, params email.Params, from string, to email.Recipient) error {+func (s *Sender) Send(ctx email.Context, templateName string, params email.Params, from string, to email.Recipient) error {if to.Address == "" {return nil}@@ -73,9 +72,10 @@ func (s *Sender) Send(tenant *models.Tenant, templateName string, params email.P"Params": to.Params,})- message := email.RenderMessage(templateName, params.Merge(to.Params))+ message := email.RenderMessage(ctx, templateName, params.Merge(to.Params))b := builder{}b.Set("From", fmt.Sprintf("%s <%s>", from, email.NoReply))+ b.Set("Reply-To", email.NoReply)b.Set("To", fmt.Sprintf("%s <%s>", to.Name, to.Address))b.Set("Subject", message.Subject)b.Set("MIME-version", "1.0")@@ -93,9 +93,9 @@ func (s *Sender) Send(tenant *models.Tenant, templateName string, params email.P}// BatchSend an email to multiple recipients-func (s *Sender) BatchSend(tenant *models.Tenant, templateName string, params email.Params, from string, to []email.Recipient) error {+func (s *Sender) BatchSend(ctx email.Context, templateName string, params email.Params, from string, to []email.Recipient) error {for _, r := range to {- if err := s.Send(tenant, templateName, params, from, r); err != nil {+ if err := s.Send(ctx, templateName, params, from, r); err != nil {return errors.Wrap(err, "failed to batch send email to %d recipients", len(to))}}diff --git a/app/pkg/email/smtp/smtp_test.go b/app/pkg/email/smtp/smtp_test.goindex 85fc911f1..68eb4b1e6 100644--- a/app/pkg/email/smtp/smtp_test.go+++ b/app/pkg/email/smtp/smtp_test.go@@ -4,6 +4,8 @@ import (gosmtp "net/smtp""testing"+ "github.com/getfider/fider/app/pkg/worker"+"github.com/getfider/fider/app/models". "github.com/getfider/fider/app/pkg/assert""github.com/getfider/fider/app/pkg/email"@@ -19,10 +21,14 @@ type request struct {body []byte}-var sender = smtp.NewSender(noop.NewLogger(), "localhost", "1234", "us3r", "p4ss")+var logger = noop.NewLogger()+var sender = smtp.NewSender(logger, "localhost", "1234", "us3r", "p4ss")var tenant = &models.Tenant{Subdomain: "got",}++var ctx = worker.NewContext("ID-1", "TaskName", nil, logger)+var requests = make([]request, 0)func mockSend(servername string, auth gosmtp.Auth, from string, to []string, body []byte) error {@@ -31,6 +37,7 @@ func mockSend(servername string, auth gosmtp.Auth, from string, to []string, bod}func reset() {+ ctx.SetTenant(tenant)sender.ReplaceSend(mockSend)requests = make([]request, 0)}@@ -43,7 +50,7 @@ func TestSend_Success(t *testing.T) {Name: "Jon Sow",Address: "[email protected]",}- err := sender.Send(tenant, "echo_test", email.Params{+ err := sender.Send(ctx, "echo_test", email.Params{"name": "Hello",}, "Fider Test", to)@@ -53,7 +60,8 @@ func TestSend_Success(t *testing.T) {Expect(requests[0].auth).Equals(gosmtp.PlainAuth("", "us3r", "p4ss", "localhost"))Expect(requests[0].from).Equals("[email protected]")Expect(requests[0].to).Equals([]string{"[email protected]"})- Expect(string(requests[0].body)).Equals("From: Fider Test <[email protected]>\r\nTo: Jon Sow <[email protected]>\r\nSubject: Message to: Hello\r\nMIME-version: 1.0\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\nHello World Hello!")+ Expect(string(requests[0].body)).ContainsSubstring("From: Fider Test <[email protected]>\r\nReply-To: [email protected]\r\nTo: Jon Sow <[email protected]>\r\nSubject: Message to: Hello\r\nMIME-version: 1.0\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\n")+ Expect(string(requests[0].body)).ContainsSubstring("Hello World Hello!")}func TestSend_SkipEmptyAddress(t *testing.T) {RegisterT(t)@@ -63,7 +71,7 @@ func TestSend_SkipEmptyAddress(t *testing.T) {Name: "Jon Sow",Address: "",}- err := sender.Send(tenant, "echo_test", email.Params{+ err := sender.Send(ctx, "echo_test", email.Params{"name": "Hello",}, "Fider Test", to)@@ -80,7 +88,7 @@ func TestSend_SkipUnlistedAddress(t *testing.T) {Name: "Jon Sow",Address: "[email protected]",}- err := sender.Send(tenant, "echo_test", email.Params{+ err := sender.Send(ctx, "echo_test", email.Params{"name": "Hello",}, "Fider Test", to)@@ -110,7 +118,7 @@ func TestBatch_Success(t *testing.T) {},}- err := sender.BatchSend(tenant, "echo_test", email.Params{}, "Fider Test", to)+ err := sender.BatchSend(ctx, "echo_test", email.Params{}, "Fider Test", to)Expect(err).IsNil()Expect(requests).HasLen(2)@@ -119,11 +127,13 @@ func TestBatch_Success(t *testing.T) {Expect(requests[0].auth).Equals(gosmtp.PlainAuth("", "us3r", "p4ss", "localhost"))Expect(requests[0].from).Equals("[email protected]")Expect(requests[0].to).Equals([]string{"[email protected]"})- Expect(string(requests[0].body)).Equals("From: Fider Test <[email protected]>\r\nTo: Jon Sow <[email protected]>\r\nSubject: Message to: Jon\r\nMIME-version: 1.0\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\nHello World Jon!")+ Expect(string(requests[0].body)).ContainsSubstring("From: Fider Test <[email protected]>\r\nReply-To: [email protected]\r\nTo: Jon Sow <[email protected]>\r\nSubject: Message to: Jon\r\nMIME-version: 1.0\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\n")+ Expect(string(requests[0].body)).ContainsSubstring("Hello World Jon!")Expect(requests[1].servername).Equals("localhost:1234")Expect(requests[1].auth).Equals(gosmtp.PlainAuth("", "us3r", "p4ss", "localhost"))Expect(requests[1].from).Equals("[email protected]")Expect(requests[1].to).Equals([]string{"[email protected]"})- Expect(string(requests[1].body)).Equals("From: Fider Test <[email protected]>\r\nTo: Arya Stark <[email protected]>\r\nSubject: Message to: Arya\r\nMIME-version: 1.0\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\nHello World Arya!")+ Expect(string(requests[1].body)).ContainsSubstring("From: Fider Test <[email protected]>\r\nReply-To: [email protected]\r\nTo: Arya Stark <[email protected]>\r\nSubject: Message to: Arya\r\nMIME-version: 1.0\r\nContent-Type: text/html; charset=\"UTF-8\"\r\n\r\n")+ Expect(string(requests[1].body)).ContainsSubstring("Hello World Arya!")}diff --git a/app/pkg/web/context.go b/app/pkg/web/context.goindex 2264c2245..2f10a1246 100644--- a/app/pkg/web/context.go+++ b/app/pkg/web/context.go@@ -118,6 +118,7 @@ func (ctx *Context) Enqueue(task worker.Task) {wc.SetUser(c.User())wc.SetTenant(c.Tenant())wc.SetBaseURL(c.BaseURL())+ wc.SetLogoURL(c.LogoURL())return task.Job(wc)}}@@ -134,7 +135,7 @@ func (ctx *Context) Enqueue(task worker.Task) {}//Tenant returns current tenant-func (ctx *Context) Tenant() *models.Tenant {+func (ctx Context) Tenant() *models.Tenant {tenant, ok := ctx.Get(tenantContextKey).(*models.Tenant)if ok {return tenant@@ -480,3 +481,19 @@ func (ctx *Context) TenantAssetsURL(path string, a ...interface{}) string {}return ctx.BaseURL() + path}++// LogoURL return the full URL to the tenant-specific logo URL+func (ctx Context) LogoURL() string {+ if ctx.Tenant() != nil && ctx.Tenant().LogoID > 0 {+ return ctx.TenantAssetsURL("/images/200/%d", ctx.Tenant().LogoID)+ }+ return "https://getfider.com/images/logo-100x100.png"+}++// FaviconURL return the full URL to the tenant-specific favicon URL+func (ctx Context) FaviconURL() string {+ if ctx.Tenant() != nil && ctx.Tenant().LogoID > 0 {+ return ctx.TenantAssetsURL("/images/50/%d", ctx.Tenant().LogoID)+ }+ return ctx.GlobalAssetsURL("/favicon.ico")+}diff --git a/app/pkg/web/renderer.go b/app/pkg/web/renderer.goindex f0fc21ecb..b8efa2777 100644--- a/app/pkg/web/renderer.go+++ b/app/pkg/web/renderer.go@@ -118,15 +118,8 @@ func (r *Renderer) Render(w io.Writer, name string, props Props, ctx *Context) {m["__jsBundle"] = ctx.GlobalAssetsURL("/assets/js/%s", r.assets["main.js"])m["__cssBundle"] = ctx.GlobalAssetsURL("/assets/css/%s", r.assets["main.css"])m["__fontBundle"] = ctx.GlobalAssetsURL("/assets/fonts/%s", r.assets["icons.woff2"])-- if ctx.Tenant() != nil && ctx.Tenant().LogoID > 0 {- m["__logo"] = ctx.TenantAssetsURL("/images/200/%d", ctx.Tenant().LogoID)- m["__favicon"] = ctx.TenantAssetsURL("/images/50/%d", ctx.Tenant().LogoID)- } else {- m["__logo"] = "https://getfider.com/images/logo-100x100.png"- m["__favicon"] = ctx.GlobalAssetsURL("/favicon.ico")- }-+ m["__logo"] = ctx.LogoURL()+ m["__favicon"] = ctx.FaviconURL()m["__contextID"] = ctx.ContextID()m["__currentURL"] = ctx.Request.URL.String()m["__tenant"] = ctx.Tenant()diff --git a/app/pkg/worker/context.go b/app/pkg/worker/context.goindex 41542ee1d..bf45582d5 100644--- a/app/pkg/worker/context.go+++ b/app/pkg/worker/context.go@@ -17,6 +17,7 @@ type Context struct {logger log.Loggerdb *dbx.DatabasebaseURL string+ logoURL stringuser *models.Usertenant *models.Tenant}@@ -40,13 +41,20 @@ func (c *Context) SetBaseURL(baseURL string) {c.baseURL = baseURL}+//SetLogoURL on context+func (c *Context) SetLogoURL(logoURL string) {+ c.logoURL = logoURL+}+//SetUser on contextfunc (c *Context) SetUser(user *models.User) {c.user = userif user != nil {c.logger.SetProperty(log.PropertyKeyUserID, user.ID)}- c.services.SetCurrentUser(user)+ if c.services != nil {+ c.services.SetCurrentUser(user)+ }}//SetTenant on context@@ -55,7 +63,9 @@ func (c *Context) SetTenant(tenant *models.Tenant) {if tenant != nil {c.logger.SetProperty(log.PropertyKeyTenantID, tenant.ID)}- c.services.SetCurrentTenant(tenant)+ if c.services != nil {+ c.services.SetCurrentTenant(tenant)+ }}//SetServices on current context@@ -109,3 +119,8 @@ func (c *Context) Failure(err error) error {c.logger.Error(err)return err}++// LogoURL return the full URL to the tenant-specific logo URL+func (c Context) LogoURL() string {+ return c.logoURL+}diff --git a/app/tasks/tasks.go b/app/tasks/tasks.goindex 114d22c80..1f81b5ab7 100644--- a/app/tasks/tasks.go+++ b/app/tasks/tasks.go@@ -29,9 +29,10 @@ func linkWithText(text, baseURL, path string, args ...interface{}) template.HTMLfunc SendSignUpEmail(model *models.CreateTenant, baseURL string) worker.Task {return describe("Send sign up email", func(c *worker.Context) error {to := email.NewRecipient(model.Name, model.Email, email.Params{+ "logo": "https://getfider.com/images/logo-100x100.png","link": link(baseURL, "/signup/verify?k=%s", model.VerificationKey),})- return c.Services().Emailer.Send(c.Tenant(), "signup_email", email.Params{}, "Fider", to)+ return c.Services().Emailer.Send(c, "signup_email", email.Params{}, "Fider", to)})}@@ -42,7 +43,7 @@ func SendSignInEmail(model *models.SignInByEmail) worker.Task {"tenantName": c.Tenant().Name,"link": link(c.BaseURL(), "/signin/verify?k=%s", model.VerificationKey),})- return c.Services().Emailer.Send(c.Tenant(), "signin_email", email.Params{}, c.Tenant().Name, to)+ return c.Services().Emailer.Send(c, "signin_email", email.Params{}, c.Tenant().Name, to)})}@@ -60,7 +61,7 @@ func SendChangeEmailConfirmation(model *models.ChangeUserEmail) worker.Task {"newEmail": model.Email,"link": link(c.BaseURL(), "/change-email/verify?k=%s", model.VerificationKey),})- return c.Services().Emailer.Send(c.Tenant(), "change_emailaddress_email", email.Params{}, c.Tenant().Name, to)+ return c.Services().Emailer.Send(c, "change_emailaddress_email", email.Params{}, c.Tenant().Name, to)})}@@ -97,13 +98,16 @@ func NotifyAboutNewPost(post *models.Post) worker.Task {}params := email.Params{- "title": fmt.Sprintf("[%s] %s", c.Tenant().Name, post.Title),- "content": markdown.Parse(post.Description),- "view": linkWithText("View it on your browser", c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),- "change": linkWithText("change your notification settings", c.BaseURL(), "/settings"),+ "title": post.Title,+ "tenantName": c.Tenant().Name,+ "userName": c.User().Name,+ "content": markdown.Parse(post.Description),+ "postLink": linkWithText(fmt.Sprintf("#%d", post.Number), c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),+ "view": linkWithText("View it on your browser", c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),+ "change": linkWithText("change your notification settings", c.BaseURL(), "/settings"),}- return c.Services().Emailer.BatchSend(c.Tenant(), "new_post", params, c.User().Name, to)+ return c.Services().Emailer.BatchSend(c, "new_post", params, c.User().Name, to)})}@@ -140,14 +144,17 @@ func NotifyAboutNewComment(post *models.Post, comment *models.NewComment) worker}params := email.Params{- "title": fmt.Sprintf("[%s] %s", c.Tenant().Name, post.Title),+ "title": post.Title,+ "tenantName": c.Tenant().Name,+ "userName": c.User().Name,"content": markdown.Parse(comment.Content),+ "postLink": linkWithText(fmt.Sprintf("#%d", post.Number), c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),"view": linkWithText("View it on your browser", c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),"unsubscribe": linkWithText("unsubscribe from it", c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),"change": linkWithText("change your notification settings", c.BaseURL(), "/settings"),}- return c.Services().Emailer.BatchSend(c.Tenant(), "new_comment", params, c.User().Name, to)+ return c.Services().Emailer.BatchSend(c, "new_comment", params, c.User().Name, to)})}@@ -198,7 +205,9 @@ func NotifyAboutStatusChange(post *models.Post, prevStatus int) worker.Task {}params := email.Params{- "title": fmt.Sprintf("[%s] %s", c.Tenant().Name, post.Title),+ "title": post.Title,+ "postLink": linkWithText(fmt.Sprintf("#%d", post.Number), c.BaseURL(), "/posts/%d/%s", post.Number, post.Slug),+ "tenantName": c.Tenant().Name,"content": markdown.Parse(post.Response.Text),"status": models.GetPostStatusName(post.Status),"duplicate": duplicate,@@ -207,7 +216,7 @@ func NotifyAboutStatusChange(post *models.Post, prevStatus int) worker.Task {"change": linkWithText("change your notification settings", c.BaseURL(), "/settings"),}- return c.Services().Emailer.BatchSend(c.Tenant(), "change_status", params, c.User().Name, to)+ return c.Services().Emailer.BatchSend(c, "change_status", params, c.User().Name, to)})}@@ -227,7 +236,7 @@ func SendInvites(subject, message string, invitations []*models.UserInvitation)"message": markdown.Parse(toMessage),})}- return c.Services().Emailer.BatchSend(c.Tenant(), "invite_email", email.Params{+ return c.Services().Emailer.BatchSend(c, "invite_email", email.Params{"subject": subject,}, c.User().Name, to)})diff --git a/app/tasks/tasks_test.go b/app/tasks/tasks_test.goindex 2f3309358..6d53b0c79 100644--- a/app/tasks/tasks_test.go+++ b/app/tasks/tasks_test.go@@ -31,12 +31,13 @@ func TestSendSignUpEmailTask(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("signup_email")- Expect(emailer.Requests[0].Tenant).IsNil()+ Expect(emailer.Requests[0].Context.Tenant()).IsNil()Expect(emailer.Requests[0].Params).Equals(email.Params{})Expect(emailer.Requests[0].From).Equals("Fider")Expect(emailer.Requests[0].To).HasLen(1)Expect(emailer.Requests[0].To[0]).Equals(email.Recipient{Params: email.Params{+ "logo": "https://getfider.com/images/logo-100x100.png","link": template.HTML("<a href='http://domain.com/signup/verify?k=1234'>http://domain.com/signup/verify?k=1234</a>"),},})@@ -60,7 +61,7 @@ func TestSendSignInEmailTask(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("signin_email")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{})Expect(emailer.Requests[0].From).Equals(mock.DemoTenant.Name)Expect(emailer.Requests[0].To).HasLen(1)@@ -92,7 +93,7 @@ func TestSendChangeEmailConfirmationTask(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("change_emailaddress_email")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{})Expect(emailer.Requests[0].From).Equals(mock.DemoTenant.Name)Expect(emailer.Requests[0].To).HasLen(1)@@ -128,12 +129,15 @@ func TestNotifyAboutNewPostTask(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("new_post")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{- "title": "[Demonstration] Add support for TypeScript",- "content": template.HTML("<p>TypeScript is great, please add support for it</p>"),- "view": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>View it on your browser</a>"),- "change": template.HTML("<a href='http://domain.com/settings'>change your notification settings</a>"),+ "title": "Add support for TypeScript",+ "postLink": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>"),+ "tenantName": "Demonstration",+ "userName": "Jon Snow",+ "content": template.HTML("<p>TypeScript is great, please add support for it</p>"),+ "view": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>View it on your browser</a>"),+ "change": template.HTML("<a href='http://domain.com/settings'>change your notification settings</a>"),})Expect(emailer.Requests[0].From).Equals("Jon Snow")Expect(emailer.Requests[0].To).HasLen(1)@@ -177,9 +181,12 @@ func TestNotifyAboutNewCommentTask(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("new_comment")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{- "title": "[Demonstration] Add support for TypeScript",+ "title": "Add support for TypeScript",+ "postLink": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>"),+ "tenantName": "Demonstration",+ "userName": "Arya Stark","content": template.HTML("<p>I agree</p>"),"view": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>View it on your browser</a>"),"change": template.HTML("<a href='http://domain.com/settings'>change your notification settings</a>"),@@ -224,9 +231,11 @@ func TestNotifyAboutStatusChangeTask(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("change_status")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{- "title": "[Demonstration] Add support for TypeScript",+ "title": "Add support for TypeScript",+ "postLink": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>#1</a>"),+ "tenantName": "Demonstration","content": template.HTML("<p>Planned for next release.</p>"),"duplicate": template.HTML(""),"status": "Planned",@@ -274,9 +283,11 @@ func TestNotifyAboutStatusChangeTask_Duplicate(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("change_status")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{- "title": "[Demonstration] I need TypeScript",+ "title": "I need TypeScript",+ "postLink": template.HTML("<a href='http://domain.com/posts/2/i-need-typescript'>#2</a>"),+ "tenantName": "Demonstration","content": template.HTML(""),"duplicate": template.HTML("<a href='http://domain.com/posts/1/add-support-for-typescript'>Add support for TypeScript</a>"),"status": "Duplicate",@@ -322,7 +333,7 @@ func TestSendInvites(t *testing.T) {Expect(err).IsNil()Expect(emailer.Requests).HasLen(1)Expect(emailer.Requests[0].TemplateName).Equals("invite_email")- Expect(emailer.Requests[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailer.Requests[0].Context.Tenant()).Equals(mock.DemoTenant)Expect(emailer.Requests[0].Params).Equals(email.Params{"subject": "My Subject",})diff --git a/views/templates/base_email.tpl b/views/templates/base_email.tplnew file mode 100644index 000000000..e50c2cdd6--- /dev/null+++ b/views/templates/base_email.tpl@@ -0,0 +1,40 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<html>+ <head>+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">+ <meta name="viewport" content="width=device-width">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ </head>+ <body bgcolor="#F7F7F7" style="font-size:16px">+ <table width="100%" bgcolor="#F7F7F7" cellpadding="0" cellspacing="0" border="0" style="text-align:center;font-size:14px;">+ <tr>+ <td height="40"> </td>+ </tr>+ {{ if .logo }}+ <tr>+ <td>+ <img height="50" src="{{ .logo }}"/>+ </td>+ </tr>+ <tr>+ <td height="10" style="line-height:1px;"> </td>+ </tr>+ {{ end }}+ <tr>+ <td align="center">+ <table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" border="0" style="text-align:left;padding:20px;margin:10px;border-radius:5px;color:#1c262d;border:1px solid #ECECEC;min-width:320px;max-width:660px;">+ {{ .body }}+ </table>+ </td>+ </tr>+ <tr>+ <td>+ <span style="color:#666;font-size:11px">This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message.</span>+ </td>+ </tr>+ <tr>+ <td height="40"> </td>+ </tr>+ </table>+ </body>+</html>\ No newline at end of filediff --git a/views/templates/change_emailaddress_email.tpl b/views/templates/change_emailaddress_email.tplindex 687aae7bb..2d7b88f1e 100644--- a/views/templates/change_emailaddress_email.tpl+++ b/views/templates/change_emailaddress_email.tpl@@ -1,11 +1,17 @@subject: Confirm your new emailbody:-Hi {{ .name }},-<br /><br />-Looks like you have requested to change your email from {{ .oldEmail }} to {{ .newEmail }}.-<br />-Click the link below to confirm this operation.-<br /><br />-{{ .link }}-<br /><br />-<span style="color:#666;font-size:11px">This link will expire in 24 hours and can only be used once.</span>\ No newline at end of file+<tr>+ <td>+ <p>Hi <strong>{{ .name }}</strong>,</p>+ <p>You have requested to change your email from {{ .oldEmail }} to {{ .newEmail }}.</p>+ <p>Click the link below to confirm this operation.</p>+ </td>+</tr>+<tr>+ <td>{{ .link }}</td>+</tr>+<tr>+ <td>+ <span style="color:#666;font-size:11px">This link will expire in 24 hours and can only be used once.</span>+ </td>+</tr>\ No newline at end of filediff --git a/views/templates/change_status.tpl b/views/templates/change_status.tplindex c5a4db69c..da5795ff6 100644--- a/views/templates/change_status.tpl+++ b/views/templates/change_status.tpl@@ -1,16 +1,28 @@-subject: {{ .title }}+subject: [{{ .tenantName }}] {{ .title }}body:--{{ if .duplicate }}- <i>This post has been closed as a <strong>{{ .status }}</strong> of {{ .duplicate }}.</i>-{{ else }}- <i>Status has changed to <strong>{{ .status }}</strong>.</i> <br />-- {{ .content }}-{{ end }}--<span style="color:#666;font-size:11px">-β <br />-You are receiving this because you are subscribed to this thread. Please do not reply to this email. <br />-{{ .view }}, {{ .unsubscribe }} or {{ .change }}.-</span>\ No newline at end of file+<tr>+ <td>+ {{ if .duplicate }}+ <strong>{{ .title }} ({{ .postLink }})</strong> has been closed as a <strong>{{ .status }}</strong> of {{ .duplicate }}.+ {{ else }}+ Status of <strong>{{ .title }} ({{ .postLink }})</strong> has changed to <strong>{{ .status }}</strong>.+ {{ end }}+ </td>+</tr>+<tr>+ <td></td>+ <td height="10" style="line-height:1px;"> </td>+ <td></td>+</tr>+<tr>+ <td style="border-top:1px solid #efefef;">{{ .content }}</td>+</tr>+<tr>+ <td>+ <span style="color:#666;font-size:11px">+ β <br />+ You are receiving this because you are subscribed to this thread. <br />+ {{ .view }}, {{ .unsubscribe }} or {{ .change }}.+ </span>+ </td>+</tr>\ No newline at end of filediff --git a/views/templates/invite_email.tpl b/views/templates/invite_email.tplindex ff0a893a7..3cbe652e8 100644--- a/views/templates/invite_email.tpl+++ b/views/templates/invite_email.tpl@@ -1,3 +1,5 @@subject: {{ .subject }}body:-{{ .message }}\ No newline at end of file+<tr>+ <td>{{ .message }}</td>+</tr>\ No newline at end of filediff --git a/views/templates/new_comment.tpl b/views/templates/new_comment.tplindex 0e10a47a6..530f804b8 100644--- a/views/templates/new_comment.tpl+++ b/views/templates/new_comment.tpl@@ -1,9 +1,27 @@-subject: {{ .title }}+subject: [{{ .tenantName }}] {{ .title }}body:-{{ .content }}--<span style="color:#666;font-size:11px">-β <br />-You are receiving this because you are subscribed to this thread. Please do not reply to this email. <br />-{{ .view }}, {{ .unsubscribe }} or {{ .change }}.-</span>\ No newline at end of file+<tr>+ <td>+ <strong>{{ .userName }}</strong> left a comment on+ <strong>+ {{ .title }} ({{ .postLink }})+ </strong>+ </td>+</tr>+<tr>+ <td></td>+ <td height="10" style="line-height:1px;"> </td>+ <td></td>+</tr>+<tr>+ <td style="border-top:1px solid #efefef;">{{ .content }}</td>+</tr>+<tr>+ <td>+ <span style="color:#666;font-size:11px">+ β <br />+ You are receiving this because you are subscribed to this thread. <br />+ {{ .view }}, {{ .unsubscribe }} or {{ .change }}.+ </span>+ </td>+</tr>\ No newline at end of filediff --git a/views/templates/new_post.tpl b/views/templates/new_post.tplindex 6438d849c..cb2ce68a1 100644--- a/views/templates/new_post.tpl+++ b/views/templates/new_post.tpl@@ -1,9 +1,24 @@-subject: {{ .title }}+subject: [{{ .tenantName }}] {{ .title }}body:-{{ .content }}--<span style="color:#666;font-size:11px">-β <br />-You are receiving this because you are subscribed to this event. Please do not reply to this email. <br />-{{ .view }} or {{ .change }}.-</span>\ No newline at end of file+<tr>+ <td>+ <strong>{{ .userName }}</strong> created a new post <strong>{{ .title }} ({{ .postLink }})</strong>.+ </td>+</tr>+<tr>+ <td></td>+ <td height="10" style="line-height:1px;"> </td>+ <td></td>+</tr>+<tr>+ <td style="border-top:1px solid #efefef;">{{ .content }}</td>+</tr>+<tr>+ <td>+ <span style="color:#666;font-size:11px">+ β <br />+ You are receiving this because you are subscribed to this event. <br />+ {{ .view }} or {{ .change }}.+ </span>+ </td>+</tr>\ No newline at end of filediff --git a/views/templates/signin_email.tpl b/views/templates/signin_email.tplindex 7998a9ca8..5c530170a 100644--- a/views/templates/signin_email.tpl+++ b/views/templates/signin_email.tpl@@ -1,7 +1,16 @@subject: Sign in to {{ .tenantName }}body:-Click the link below to sign in.-<br /><br />-{{ .link }}-<br /><br />-<span style="color:#666;font-size:11px">This link will expire in 15 minutes and can only be used once.</span>\ No newline at end of file+<tr>+ <td>Click the link below to sign in to <strong>{{ .tenantName }}</strong>.</td>+</tr>+<tr>+ <td height="20"> </td>+</tr>+<tr>+ <td>{{ .link }}</td>+</tr>+<tr>+ <td>+ <span style="color:#666;font-size:11px">This link will expire in 30 minutes and can only be used once.</span>+ </td>+</tr>\ No newline at end of filediff --git a/views/templates/signup_email.tpl b/views/templates/signup_email.tplindex 4c7e1887f..82b0a4b6d 100644--- a/views/templates/signup_email.tpl+++ b/views/templates/signup_email.tpl@@ -1,7 +1,16 @@subject: Confirm your new Fider instancebody:-Click the link below to confirm your new Fider instance.-<br /><br />-{{ .link }}-<br /><br />-<span style="color:#666;font-size:11px">This link will expire in 48 hours and can only be used once.</span>\ No newline at end of file+<tr>+ <td>Click the link below to confirm your new Fider instance.</td>+</tr>+<tr>+ <td height="20"> </td>+</tr>+<tr>+ <td>{{ .link }}</td>+</tr>+<tr>+ <td>+ <span style="color:#666;font-size:11px">This link will expire in 48 hours and can only be used once.</span>+ </td>+</tr>