Skip to content

Commit 6bcd9dd

Browse files
committed
Fatal error: Uncaught phpmailerException: Mail-Funktion konnte nicht initialisiert werden. in ~\includes\lib\phpmailer\class.phpmailer.php:1524 Stack trace: #0 ~\includes\lib\phpmailer\class.phpmailer.php(1342): PHPMailer->mailSend('Date: Tue, 12 J...', 'This is a multi...') #1 ~\includes\lib\phpmailer\class.phpmailer.php(1215): PHPMailer->postSend() #2 ~\admin\includes\functions\function_kernel.php(1134): PHPMailer->send() #3 ~\admin\customers.php(138): oos_mail() #4 {main} thrown in ~\includes\lib\phpmailer\class.phpmailer.php on line 1524
1 parent 0a92156 commit 6bcd9dd

File tree

69 files changed

+48
-7437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+48
-7437
lines changed

msd/inc/header.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MyOOS [Dumper]
55
http://www.oos-shop.de/
66
7-
Copyright (c) 2020 by the MyOOS Development Team.
7+
Copyright (c) 2021 by the MyOOS Development Team.
88
----------------------------------------------------------------------
99
Based on:
1010

myoos/admin/includes/functions/function_kernel.php

+34-29
Original file line numberDiff line numberDiff line change
@@ -1071,66 +1071,71 @@ function is_image($filename) {
10711071
*/
10721072
function oos_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address) {
10731073

1074+
global $phpmailer;
10741075

10751076
if (preg_match('~[\r\n]~', $to_name)) return FALSE;
10761077
if (preg_match('~[\r\n]~', $to_email_address)) return FALSE;
10771078
if (preg_match('~[\r\n]~', $email_subject)) return FALSE;
10781079
if (preg_match('~[\r\n]~', $from_email_name)) return FALSE;
10791080
if (preg_match('~[\r\n]~', $from_email_address)) return FALSE;
10801081

1081-
$sLang = (isset($_SESSION['iso_639_1']) ? $_SESSION['iso_639_1'] : 'en');
10821082

1083-
// Instantiate a new mail object
1084-
// (Re)create it, if it's gone missing
1085-
if ( !is_object( $mail ) || !is_a( $mail, 'PHPMailer' ) ) {
1086-
require_once MYOOS_INCLUDE_PATH . '/includes/lib/phpmailer/class.phpmailer.php';
1087-
require_once MYOOS_INCLUDE_PATH . '/includes/lib/phpmailer/class.smtp.php';
1088-
// Instantiate a new mail object
1089-
$mail = new PHPMailer( TRUE );
1083+
// (Re)create it, if it's gone missing.
1084+
if ( ! ( $phpmailer instanceof PHPMailer\PHPMailer\PHPMailer ) ) {
1085+
require_once MYOOS_INCLUDE_PATH . '/includes/lib/PHPMailer/PHPMailer.php';
1086+
require_once MYOOS_INCLUDE_PATH . '/includes/lib/PHPMailer/SMTP.php';
1087+
require_once MYOOS_INCLUDE_PATH . '/includes/lib/PHPMailer/Exception.php';
1088+
$phpmailer = new PHPMailer\PHPMailer\PHPMailer( true );
1089+
1090+
$phpmailer::$validator = static function ( $to_email_address ) {
1091+
return (bool) is_email( $to_email_address );
1092+
};
10901093
}
10911094

1092-
$mail->PluginDir = OOS_ABSOLUTE_PATH . 'includes/lib/phpmailer/';
1093-
$mail->SetLanguage( $sLang, OOS_ABSOLUTE_PATH . 'includes/lib/phpmailer/language/' );
1095+
// Empty out the values that may be set.
1096+
$phpmailer->clearAllRecipients();
1097+
$phpmailer->clearAttachments();
1098+
$phpmailer->clearCustomHeaders();
1099+
$phpmailer->clearReplyTos();
10941100

1095-
$mail->CharSet = CHARSET;
1096-
$mail->IsMail();
1101+
$phpmailer->IsMail();
10971102

1098-
$mail->From = $from_email_address ? $from_email_address : STORE_OWNER_EMAIL_ADDRESS;
1099-
$mail->FromName = $from_email_name ? $from_email_name : STORE_OWNER;
1100-
$mail->Mailer = EMAIL_TRANSPORT;
1103+
$phpmailer->From = $from_email_address ? $from_email_address : STORE_OWNER_EMAIL_ADDRESS;
1104+
$phpmailer->FromName = $from_email_name ? $from_email_name : STORE_OWNER;
1105+
$phpmailer->Mailer = EMAIL_TRANSPORT;
11011106

11021107
// Add smtp values if needed
11031108
if ( EMAIL_TRANSPORT == 'smtp' ) {
1104-
$mail->IsSMTP(); // set mailer to use SMTP
1105-
$mail->SMTPAuth = OOS_SMTPAUTH; // turn on SMTP authentication
1106-
$mail->Username = OOS_SMTPUSER; // SMTP username
1107-
$mail->Password = OOS_SMTPPASS; // SMTP password
1108-
$mail->Host = OOS_SMTPHOST; // specify main and backup server
1109+
$phpmailer->IsSMTP(); // set mailer to use SMTP
1110+
$phpmailer->SMTPAuth = OOS_SMTPAUTH; // turn on SMTP authentication
1111+
$phpmailer->Username = OOS_SMTPUSER; // SMTP username
1112+
$phpmailer->Password = OOS_SMTPPASS; // SMTP password
1113+
$phpmailer->Host = OOS_SMTPHOST; // specify main and backup server
11091114
} else {
11101115
// Set sendmail path
11111116
if ( EMAIL_TRANSPORT == 'sendmail' ) {
11121117
if (!oos_empty(OOS_SENDMAIL)) {
1113-
$mail->Sendmail = OOS_SENDMAIL;
1114-
$mail->IsSendmail();
1118+
$phpmailer->Sendmail = OOS_SENDMAIL;
1119+
$phpmailer->IsSendmail();
11151120
}
11161121
}
11171122
}
11181123

1119-
$mail->AddAddress($to_email_address, $to_name);
1120-
$mail->Subject = $email_subject;
1124+
$phpmailer->AddAddress($to_email_address, $to_name);
1125+
$phpmailer->Subject = $email_subject;
11211126

11221127

11231128
// Build the text version
11241129
$text = strip_tags($email_text);
11251130
if (EMAIL_USE_HTML == 'true') {
1126-
$mail->IsHTML(TRUE);
1127-
$mail->Body = $email_text;
1128-
$mail->AltBody = $text;
1131+
$phpmailer->IsHTML(TRUE);
1132+
$phpmailer->Body = $email_text;
1133+
$phpmailer->AltBody = $text;
11291134
} else {
1130-
$mail->Body = $text;
1135+
$phpmailer->Body = $text;
11311136
}
11321137

11331138
// Send message
1134-
$mail->Send();
1139+
$phpmailer->Send();
11351140
}
11361141

myoos/admin/includes/functions/function_validations.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MyOOS [Shopsystem]
55
https://www.oos-shop.de
66
7-
Copyright (c) 2003 - 2020 by the MyOOS Development Team.
7+
Copyright (c) 2003 - 2021 by the MyOOS Development Team.
88
----------------------------------------------------------------------
99
Based on:
1010
@@ -31,7 +31,7 @@
3131
* @param $sEmail
3232
* @return boolean
3333
*/
34-
function oos_validate_is_email($value) {
34+
function is_email($value) {
3535

3636
if (!is_string($value)) return FALSE;
3737

myoos/admin/includes/main.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
require_once MYOOS_INCLUDE_PATH . '/includes/functions/function_global.php';
6363
require 'includes/functions/function_kernel.php';
64-
64+
require 'includes/functions/function_validations.php';
6565

6666
// Load server utilities
6767
require_once MYOOS_INCLUDE_PATH . '/includes/functions/function_server.php';
@@ -139,10 +139,6 @@
139139
require 'includes/functions/function_output.php';
140140
require_once MYOOS_INCLUDE_PATH . '/includes/functions/function_password.php';
141141

142-
// email classes
143-
require_once MYOOS_INCLUDE_PATH . '/includes/lib/phpmailer/class.phpmailer.php';
144-
require_once MYOOS_INCLUDE_PATH . '/includes/lib/phpmailer/class.smtp.php';
145-
146142
// setup our boxes
147143
require 'includes/classes/class_table_block.php';
148144
require 'includes/classes/class_box.php';

myoos/includes/content/account_edit.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MyOOS [Shopsystem]
55
https://www.oos-shop.de
66
7-
Copyright (c) 2003 - 2020 by the MyOOS Development Team.
7+
Copyright (c) 2003 - 2021 by the MyOOS Development Team.
88
----------------------------------------------------------------------
99
Based on:
1010
@@ -100,7 +100,7 @@
100100
if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
101101
$bError = TRUE;
102102
$oMessage->add('account_edit', $aLang['entry_email_address_error']);
103-
} elseif (oos_validate_is_email($email_address) == FALSE) {
103+
} elseif (is_email($email_address) == FALSE) {
104104
$bError = TRUE;
105105
$oMessage->add('account_edit', $aLang['entry_email_address_check_error']);
106106
} else {

myoos/includes/content/contact_us.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MyOOS [Shopsystem]
55
https://www.oos-shop.de
66
7-
Copyright (c) 2003 - 2020 by the MyOOS Development Team.
7+
Copyright (c) 2003 - 2021 by the MyOOS Development Team.
88
----------------------------------------------------------------------
99
Based on:
1010
@@ -35,7 +35,7 @@
3535

3636
$email_address = strtolower($email_address);
3737

38-
if (oos_validate_is_email(trim($email_address))) {
38+
if (is_email(trim($email_address))) {
3939

4040
if ( empty( $subject )) {
4141
$subject = $aLang['email_subject'];

myoos/includes/content/create_account.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MyOOS [Shopsystem]
55
https://www.oos-shop.de
66
7-
Copyright (c) 2003 - 2020 by the MyOOS Development Team.
7+
Copyright (c) 2003 - 2021 by the MyOOS Development Team.
88
----------------------------------------------------------------------
99
Based on:
1010
@@ -119,7 +119,7 @@
119119
if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
120120
$bError = TRUE;
121121
$oMessage->add('create_account', $aLang['entry_email_address_error']);
122-
} elseif (oos_validate_is_email($email_address) == FALSE) {
122+
} elseif (is_email($email_address) == FALSE) {
123123
$bError = TRUE;
124124
$oMessage->add('create_account', $aLang['entry_email_address_check_error']);
125125
} else {

myoos/includes/functions/function_kernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ function oos_newsletter_subscribe_mail ($email_address) {
16811681

16821682
$sLanguage = isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE;
16831683

1684-
if (oos_validate_is_email($email_address)) {
1684+
if (is_email($email_address)) {
16851685

16861686
$aContents = oos_get_content();
16871687

myoos/includes/functions/function_validations.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MyOOS [Shopsystem]
55
https://www.oos-shop.de
66
7-
Copyright (c) 2003 - 2020 by the MyOOS Development Team.
7+
Copyright (c) 2003 - 2021 by the MyOOS Development Team.
88
----------------------------------------------------------------------
99
Based on:
1010
@@ -36,7 +36,7 @@
3636
* @param $value
3737
* @return boolean
3838
*/
39-
function oos_validate_is_email($value) {
39+
function is_email($value) {
4040

4141
if (!is_string($value)) return FALSE;
4242

0 commit comments

Comments
 (0)