Skip to content

Commit

Permalink
Implement SetCC and SetBCC functions in htmlEmail lib
Browse files Browse the repository at this point in the history
  • Loading branch information
floren committed Apr 8, 2021
1 parent ec003ab commit 3f24f7e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion email/htmlEmail.ank
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Module to send HTML formatted Emails
# Example use:
# em = htmlEmail
# em.SetCC("[email protected]")
# em.SetBCC(["[email protected]", "[email protected]"])
# em.SetTitle("alert stuff")
# em.AddSubTitle("you should care about this")
# em.AddBodyData("hi")
Expand All @@ -16,6 +18,8 @@ module htmlEmail {
var body = ""
var queryinfo = ""
var time = import("time")
var cc = ""
var bcc = ""

func AddEntsTable(ents, cols) {
var ret = `<table><tr>`
Expand Down Expand Up @@ -91,6 +95,14 @@ module htmlEmail {
}
}

func SetCC(v) {
cc = v
}

func SetBCC(v) {
bcc = v
}

func SendEmail(from, to, subj) {
var data = `<html>`
if title != "" {
Expand All @@ -101,7 +113,7 @@ module htmlEmail {
data += `<br><br>` + queryinfo
}
data += `</html>`
return email(from, to, subj, data)
return emailWithCC(from, to, cc, bcc, subj, data)
}
}

0 comments on commit 3f24f7e

Please sign in to comment.