@@ -21,7 +21,6 @@ import io.xh.hoist.util.Utils
21
21
class EmailService extends BaseService {
22
22
23
23
def configService
24
- def groovyPageRenderer
25
24
26
25
private Date lastSentDate = null
27
26
private Long emailsSent = 0
@@ -40,12 +39,10 @@ class EmailService extends BaseService {
40
39
* logIdentifier {String} - optional, string to append to log message, defaults to subject
41
40
* throwError {Boolean} - option to throw on error or to suppress and log, defaults to false
42
41
*
43
- * To determine email body, either "text" OR "html" OR ("view" AND "model") must be included in args:
42
+ * To determine email body, either "text" OR "html" must be included in args:
44
43
*
45
44
* text {String} - plain text message
46
45
* html {String} - html message
47
- * view - gsp file path
48
- * model - model to be applied to the view
49
46
*
50
47
* To attach file(s) to the email, include:
51
48
*
@@ -83,8 +80,8 @@ class EmailService extends BaseService {
83
80
env = Utils . appEnvironment. displayName. toUpperCase(),
84
81
envString = Utils . isProduction ? ' ' : " [$env ]" ,
85
82
subj = args. subject + envString,
86
- isAsync = args. containsKey( ' async' ) ? args . async : false ,
87
- isMultipart = args. containsKey( ' attachments' ) ,
83
+ isAsync = args. async as boolean ,
84
+ isMultipart = args. attachments as boolean ,
88
85
attachments = []
89
86
90
87
if (isMultipart) {
@@ -118,10 +115,7 @@ class EmailService extends BaseService {
118
115
} else if (args. containsKey(' text' )) {
119
116
text args. text as String
120
117
} else {
121
- html groovyPageRenderer. render(
122
- view : args. view,
123
- model : args. model
124
- )
118
+ throw new RuntimeException (" Must provide 'html' or 'text' for email." )
125
119
}
126
120
127
121
attachments. each { Map f ->
0 commit comments