-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SetCC and SetBCC functions in htmlEmail lib
- Loading branch information
Showing
1 changed file
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
|
@@ -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>` | ||
|
@@ -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 != "" { | ||
|
@@ -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) | ||
} | ||
} | ||
|