File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ class MailerManager {
37
37
'user ' => '' ,
38
38
'password ' => '' ,
39
39
'protocol ' => 'smtp ' ,
40
+ 'CharSet ' => 'utf-8 ' ,
40
41
'ns ' => 'mail '
41
42
];
42
43
@@ -67,6 +68,7 @@ public static function start() {
67
68
}
68
69
$ mailer ->isHTML (true );
69
70
self ::$ mailer = $ mailer ;
71
+ self ::applyConfig ($ config );
70
72
self ::$ queue = new MailerQueue ();
71
73
}
72
74
@@ -160,6 +162,28 @@ protected static function _getFiles($silent = false) {
160
162
return UFileSystem::glob_recursive ($ typeDir . \DS . '*.php ' );
161
163
}
162
164
165
+ protected static function applyConfig ($ config ) {
166
+ $ config = \array_diff_key ($ config , [
167
+ 'host ' => 0 ,
168
+ 'port ' => 0 ,
169
+ 'protocol ' => 0 ,
170
+ 'SMTPOptions ' => 0 ,
171
+ 'auth ' => 0 ,
172
+ 'password ' => 0 ,
173
+ 'user ' => 0
174
+ ]);
175
+ $ reflex = new \ReflectionClass (self ::$ mailer );
176
+ foreach ($ config as $ k => $ v ) {
177
+ if ($ reflex ->hasProperty ($ k )) {
178
+ $ prop = $ reflex ->getProperty ($ k );
179
+ $ prop ->setAccessible (true );
180
+ $ prop ->setValue (self ::$ mailer , $ v );
181
+ } elseif ($ reflex ->hasMethod ($ k )) {
182
+ $ reflex ->getMethod ($ k )->invoke (self ::$ mailer , $ v );
183
+ }
184
+ }
185
+ }
186
+
163
187
/**
164
188
* Returns an array of the mail class names
165
189
*
You can’t perform that action at this time.
0 commit comments