File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,13 @@ class PHPMailer
423
423
*/
424
424
public $ DKIM_private = '' ;
425
425
426
+ /**
427
+ * DKIM private key string.
428
+ * If set, takes precedence over `$DKIM_private`.
429
+ * @var string
430
+ */
431
+ public $ DKIM_private_string = '' ;
432
+
426
433
/**
427
434
* Callback Action function name.
428
435
*
@@ -1289,7 +1296,7 @@ public function preSend()
1289
1296
if (!empty ($ this ->DKIM_domain )
1290
1297
&& !empty ($ this ->DKIM_private )
1291
1298
&& !empty ($ this ->DKIM_selector )
1292
- && file_exists ($ this ->DKIM_private )) {
1299
+ && (! empty ( $ this -> DKIM_private_string ) || file_exists ($ this ->DKIM_private ) )) {
1293
1300
$ header_dkim = $ this ->DKIM_Add (
1294
1301
$ this ->MIMEHeader . $ this ->mailHeader ,
1295
1302
$ this ->encodeHeader ($ this ->secureHeader ($ this ->Subject )),
@@ -3717,7 +3724,7 @@ public function DKIM_Sign($signHeader)
3717
3724
}
3718
3725
return '' ;
3719
3726
}
3720
- $ privKeyStr = file_get_contents ($ this ->DKIM_private );
3727
+ $ privKeyStr = ! empty ( $ this -> DKIM_private_string ) ? $ this -> DKIM_private_string : file_get_contents ($ this ->DKIM_private );
3721
3728
if ('' != $ this ->DKIM_passphrase ) {
3722
3729
$ privKey = openssl_pkey_get_private ($ privKeyStr , $ this ->DKIM_passphrase );
3723
3730
} else {
You can’t perform that action at this time.
0 commit comments