@@ -12,6 +12,10 @@ const CONTENT_TYPES = {
12
12
text : 'text/plain'
13
13
} ;
14
14
15
+ const arrayOrString = ( str ) => {
16
+ return Array . isArray ( str ) ? str : str . split ( ',' ) ;
17
+ } ;
18
+
15
19
Routing = ( template , settings , render , compile ) => {
16
20
check ( template . name , String ) ;
17
21
check ( template . route . path , String ) ;
@@ -22,7 +26,7 @@ Routing = (template, settings, render, compile) => {
22
26
const previewAction = ( type ) => {
23
27
check ( type , Match . OneOf ( 'html' , 'text' ) ) ;
24
28
25
- return ( req , res , params , template ) => {
29
+ return ( req , res , params , _ ) => {
26
30
let data = null ;
27
31
28
32
try {
@@ -71,7 +75,7 @@ Routing = (template, settings, render, compile) => {
71
75
} ;
72
76
} ;
73
77
74
- const sendAction = ( req , res , params , template ) => {
78
+ const sendAction = ( req , res , params , _ ) => {
75
79
const { to = settings . testEmail , cc, bcc} = params . query ;
76
80
77
81
Utils . Logger . info ( `Sending ${ template . name } …` ) ;
@@ -87,18 +91,18 @@ Routing = (template, settings, render, compile) => {
87
91
}
88
92
89
93
const options = {
90
- to,
94
+ to : arrayOrString ( to ) ,
91
95
data,
92
96
template : template . name ,
93
97
subject : '[TEST] ' + template . name
94
98
} ;
95
99
96
100
if ( cc ) {
97
- options . cc = cc ;
101
+ options . cc = arrayOrString ( cc ) ;
98
102
}
99
103
100
104
if ( bcc ) {
101
- options . bcc = bcc ;
105
+ options . bcc = arrayOrString ( bcc ) ;
102
106
}
103
107
104
108
const result = Mailer . send ( options ) ;
0 commit comments