@@ -32,8 +32,10 @@ class EmailService extends BaseService {
3232 * @param args
3333 * to {String or List} - required, email address(es) of recipient(s)
3434 * from {String} - optional, sender address, defaults to config
35- * cc {String or List} - optional, cc recipients;
35+ * cc {String or List} - optional, cc recipients
36+ * bcc {String or List} - optional, bcc recipients
3637 * subject {String} - optional
38+ * markImportant {boolean} - optional, to mark email as important via standard headers, default false
3739 * async {Boolean} - option to send email asynchronously, defaults to false
3840 * doLog {Boolean} - option to log email information on send, defaults to true
3941 * logIdentifier {String} - optional, string to append to log message, defaults to subject
@@ -60,10 +62,12 @@ class EmailService extends BaseService {
6062 def override = parseMailConfig(' xhEmailOverride' ),
6163 filter = parseMailConfig(' xhEmailFilter' ),
6264 toSpec = filterAddresses(formatAddresses(args. to), filter),
63- ccSpec = filterAddresses(formatAddresses(args. cc), filter)
65+ ccSpec = filterAddresses(formatAddresses(args. cc), filter),
66+ bccSpec = filterAddresses(formatAddresses(args. bcc), filter)
6467
6568 List<String > toUse = override ? override : toSpec
6669 List<String > ccUse = override ? [] : ccSpec
70+ List<String > bccUse = override ? [] : bccSpec
6771 String fromUse = args. from ? formatAddresses(args. from)[0 ] : parseMailConfig(' xhEmailDefaultSender' )[0 ]
6872 String subjectUse = args. subject ?: ' '
6973 List<Map > attachments = parseAttachments(args. attachments)
@@ -92,7 +96,7 @@ class EmailService extends BaseService {
9296 devContext << Utils . appEnvironment. displayName. toUpperCase();
9397 }
9498 if (override) {
95- devContext << (toSpec. size() > 1 ? " for ${ toSpec.size()} receipients " : " for ${ toSpec.first()} " )
99+ devContext << (toSpec. size() > 1 ? " for ${ toSpec.size()} recipients " : " for ${ toSpec.first()} " )
96100 }
97101 if (devContext) {
98102 subjectUse + = " [${ devContext.join(', ')} ]"
@@ -107,6 +111,17 @@ class EmailService extends BaseService {
107111 if (ccUse) {
108112 cc ccUse. toArray()
109113 }
114+ if (bccUse) {
115+ bcc bccUse. toArray()
116+ }
117+ if (args. markImportant) {
118+ headers (
119+ ' Importance' : ' High' ,
120+ ' X-MSMail-Priority' : ' High' ,
121+ ' X-Priority' : 1
122+ )
123+ }
124+
110125 subject subjectUse. take(255 )
111126
112127 if (args. containsKey(' html' )) {
0 commit comments