@@ -594,12 +594,35 @@ public function Send() {
594
594
* @access protected
595
595
* @return bool
596
596
*/
597
- protected function SendmailSend ($ header , $ body ) {
598
- if ($ this ->Sender != '' ) {
599
- $ sendmail = sprintf ("%s -oi -f %s -t " , escapeshellcmd ($ this ->Sendmail ), escapeshellarg ($ this ->Sender ));
600
- } else {
601
- $ sendmail = sprintf ("%s -oi -t " , escapeshellcmd ($ this ->Sendmail ));
602
- }
597
+ protected function SendmailSend ($ header , $ body )
598
+ {
599
+ if (!(is_file ($ this ->Sendmail ) and is_executable ($ this ->Sendmail ))) {
600
+ throw new phpmailerException (
601
+ $ this ->lang ('execute ' ).$ this ->Sendmail ,
602
+ self ::STOP_CRITICAL
603
+ );
604
+ }
605
+ if (!empty ($ this ->Sender ) and $ this ->validateAddress ($ this ->Sender )) {
606
+ if ($ this ->Mailer == 'qmail ' ) {
607
+ $ sendmail = sprintf (
608
+ '%s -f%s ' ,
609
+ escapeshellcmd ($ this ->Sendmail ),
610
+ escapeshellarg ($ this ->Sender )
611
+ );
612
+ } else {
613
+ $ sendmail = sprintf (
614
+ '%s -oi -f%s -t ' ,
615
+ escapeshellcmd ($ this ->Sendmail ),
616
+ escapeshellarg ($ this ->Sender )
617
+ );
618
+ }
619
+ } else {
620
+ if ($ this ->Mailer == 'qmail ' ) {
621
+ $ sendmail = sprintf ('%s ' , escapeshellcmd ($ this ->Sendmail ));
622
+ } else {
623
+ $ sendmail = sprintf ('%s -oi -t ' , escapeshellcmd ($ this ->Sendmail ));
624
+ }
625
+ }
603
626
if ($ this ->SingleTo === true ) {
604
627
foreach ($ this ->SingleToArray as $ key => $ val ) {
605
628
if (!@$ mail = popen ($ sendmail , 'w ' )) {
@@ -648,7 +671,7 @@ protected function MailSend($header, $body) {
648
671
$ to = implode (', ' , $ toArr );
649
672
650
673
$ params = sprintf ("-oi -f %s " , $ this ->Sender );
651
- if ($ this ->Sender != '' && strlen ( ini_get ('safe_mode ' ))< 1 ) {
674
+ if (! empty ( $ this ->Sender ) and ! ini_get ('safe_mode ' ) and $ this -> validateAddress ( $ this -> Sender ) ) {
652
675
$ old_from = ini_get ('sendmail_from ' );
653
676
ini_set ('sendmail_from ' , $ this ->Sender );
654
677
if ($ this ->SingleTo === true && count ($ toArr ) > 1 ) {
@@ -704,7 +727,12 @@ protected function SmtpSend($header, $body) {
704
727
if (!$ this ->SmtpConnect ()) {
705
728
throw new phpmailerException ($ this ->Lang ('smtp_connect_failed ' ), self ::STOP_CRITICAL );
706
729
}
707
- $ smtp_from = ($ this ->Sender == '' ) ? $ this ->From : $ this ->Sender ;
730
+
731
+ if (!empty ($ this ->Sender ) and $ this ->validateAddress ($ this ->Sender )) {
732
+ $ smtp_from = $ this ->Sender ;
733
+ } else {
734
+ $ smtp_from = $ this ->From ;
735
+ }
708
736
if (!$ this ->smtp ->Mail ($ smtp_from )) {
709
737
throw new phpmailerException ($ this ->Lang ('from_failed ' ) . $ smtp_from , self ::STOP_CRITICAL );
710
738
}
@@ -2013,9 +2041,7 @@ public function AddCustomHeader($custom_header) {
2013
2041
/**
2014
2042
* Evaluates the message and returns modifications for inline images and backgrounds
2015
2043
* @access public
2016
- * @param string $message
2017
- * @param string $basedir
2018
- * @return void
2044
+ * @return $message
2019
2045
*/
2020
2046
public function MsgHTML ($ message , $ basedir = '' ) {
2021
2047
preg_match_all ("/(src|background)= \"(.*) \"/Ui " , $ message , $ images );
@@ -2334,4 +2360,3 @@ public function errorMessage() {
2334
2360
return $ errorMsg ;
2335
2361
}
2336
2362
}
2337
- ?>
0 commit comments