base_object = $base_object; } function send_mail($subject, $message, $recipient = false, $logo = false, $recipients_from_db = false, $reply_to = false, $from_mail = false, $from_name = false, $attachments = false) { $mail = new PHPMailer(true); date_default_timezone_set("Europe/Berlin"); $subject = utf8_decode($subject); $from_name = ($from_name) ? mb_encode_mimeheader(utf8_decode($from_name), "UTF-8", "Q") : false; $recipients['to'] = ($recipient) ? $recipient : $global_mail_settings['mail_to']['global']; $email = $this->base_object->config->shopConfiguration['system_email']; $from_mail = $this->base_object->config->shopConfiguration['system_email']; $host = $this->base_object->config->shopConfiguration['system_email_host']; $user = $this->base_object->config->shopConfiguration['system_email_user']; $pass = $this->base_object->config->shopConfiguration['system_email_password']; $from_name = $this->base_object->config->shopConfiguration['system_email_name']; $reply_to = $this->base_object->config->shopConfiguration['system_email_reply']; // read css file $file_name = (isset($this->base_object->layout) && $this->base_object->layout) ? $this->base_object->layout->template_dir.'/../media/css/mail.css' : ''; $css = ''; if (file_exists($file_name)) { $handle = fopen($file_name, "r"); while (!feof($handle)) { $css .= fgets($handle,2); }; fclose($handle); } try { //Server settings /*$mail->SMTPDebug = SMTP::DEBUG_SERVER; // OUTPUT DEBUG $mail->SMTPDebug = 3;*/ $mail->isSMTP(); $mail->Host = $host; $mail->SMTPAuth = true; $mail->Username = $user; $mail->Password = $pass; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->SMTPOptions = array('ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => false )); $mail->Port = 587; //Recipients $mail->setFrom($from_mail, $from_name); $mail->addAddress($recipients['to']); if ($reply_to) $mail->addReplyTo($reply_to, $from_name); if (isset($recipients['cc']) && $recipients['cc']) $mail->addCC($recipients['cc']); if (isset($recipients['bcc']) && $recipients['bcc']) $mail->addBCC($recipients['bcc']); //Attachments if ($attachments != false) foreach ($attachments as $att) $mail->addStringAttachment($att->content, $att->file_name); //Content $mail->isHTML(true); $mail->Subject = $subject; $inline_message = $inline_message ?? ''; $inline_logo = $inline_logo ?? ''; $body = '
'.utf8_decode($message).'