diff --git a/controllers/api.go b/controllers/api.go index 6db158f3..6cb75bb1 100644 --- a/controllers/api.go +++ b/controllers/api.go @@ -530,18 +530,18 @@ func API_Send_Test_Email(w http.ResponseWriter, r *http.Request) { if s.Template.Name == "" { //default message body text := "It works!\n\nThis is an email letting you know that your gophish\nconfiguration was successful.\n" + - "Here are the details:\n\nWho you sent from: {{.From}}\n\nWho you sent to: \n" + - "{{if .FirstName}} First Name: {{.FirstName}}\n{{end}}" + - "{{if .LastName}} Last Name: {{.LastName}}\n{{end}}" + - "{{if .Position}} Position: {{.Position}}\n{{end}}" + - "{{if .TrackingURL}} Tracking URL: {{.TrackingURL}}\n{{end}}" + - "\nNow go send some phish!" + "Here are the details:\n\nWho you sent from: {{.From}}\n\nWho you sent to: \n" + + "{{if .FirstName}} First Name: {{.FirstName}}\n{{end}}" + + "{{if .LastName}} Last Name: {{.LastName}}\n{{end}}" + + "{{if .Position}} Position: {{.Position}}\n{{end}}" + + "{{if .TrackingURL}} Tracking URL: {{.TrackingURL}}\n{{end}}" + + "\nNow go send some phish!" t := models.Template{ Subject: "Default Email from Gophish", - Text: text, + Text: text, } s.Template = t - // Try to lookup the Template by name + // Try to lookup the Template by name } else { // Get the Template requested by name s.Template, err = models.GetTemplateByName(s.Template.Name, ctx.Get(r, "user_id").(int64)) diff --git a/models/template.go b/models/template.go index d1daa4b1..c6027cc6 100644 --- a/models/template.go +++ b/models/template.go @@ -17,7 +17,7 @@ type Template struct { HTML string `json:"html" gorm:"column:html"` ModifiedDate time.Time `json:"modified_date"` Attachments []Attachment `json:"attachments"` -} +} // ErrTemplateNameNotSpecified is thrown when a template name is not specified var ErrTemplateNameNotSpecified = errors.New("Template name not specified")