Began work on emailing service #1456

This commit is contained in:
Torkel Ödegaard
2015-06-04 14:29:39 +02:00
parent 83279604c6
commit 3f5ab189cd
9 changed files with 334 additions and 0 deletions

24
pkg/models/emails.go Normal file
View File

@@ -0,0 +1,24 @@
package models
type SendEmailCommand struct {
To []string
From string
Subject string
Body string
Type string
Massive bool
Info string
}
// create mail content
func (m *SendEmailCommand) Content() string {
// set mail type
contentType := "text/plain; charset=UTF-8"
if m.Type == "html" {
contentType = "text/html; charset=UTF-8"
}
// create mail content
content := "From: " + m.From + "\r\nSubject: " + m.Subject + "\r\nContent-Type: " + contentType + "\r\n\r\n" + m.Body
return content
}