Skip to content

Commit

Permalink
HTML Support in Sending Email
Browse files Browse the repository at this point in the history
  • Loading branch information
Romnick Mamisay committed Mar 9, 2019
1 parent b84bbd8 commit 5e595ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/_build/html/quiz/js/timer.js
Expand Up @@ -132,5 +132,6 @@ function startTimer(duration, display) {
clearInterval(tt);
resetFunc();
loadTimer();
window.scrollTo(0, 0);
});
}
6 changes: 4 additions & 2 deletions send_email.go
Expand Up @@ -24,17 +24,19 @@ func SendEmail(to, cc, bcc []string, subject, body string) (err error) {
domain[0] = strings.TrimSuffix(domain[0], ">")

// Construct the email
MIME := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n"

msg := "From: " + EmailFrom + "\r\n"
msg += "To: " + strings.Join(to, ",") + "\r\n"
if len(cc) > 0 {
msg += "CC: " + strings.Join(cc, ",") + "\r\n"
}
msg += "Date: " + time.Now().UTC().Format(time.RFC1123Z) + "\r\n"
msg += "Message-ID: " + fmt.Sprintf("<%s-%s-%s-%s-%s@%s>", GenerateBase32(8), GenerateBase32(4), GenerateBase32(4), GenerateBase32(4), GenerateBase32(12), domain[0]) + "\r\n"
msg += "Subject: " + subject + "\r\n\r\n"
msg += "Subject: " + subject + "\r\n"
msg += MIME + "\r\n"
msg += strings.Replace(body, "\n", "\r\n", -1)
msg += "\r\n"

// Append CC and BCC
to = append(to, cc...)
to = append(to, bcc...)
Expand Down

0 comments on commit 5e595ff

Please sign in to comment.