'mailing@newwalls.pl', 'email_host' => 'poczta.s-hosting.pl', 'email_login' => 'mailing@newwalls.pl', 'email_password' => 'b9N!x5S#w2', 'email_port' => 465, ); if (isset($_POST['name'])) { $data = $_POST; $name = $data['name']; $surname = $data['surname']; $email = $data['email']; $contact_type = $data['contact_type']; $message = $data['text']; $mail = new PHPMailer(); // Server settings $mail->isSMTP(); $mail->Host = $settings['email_host']; $mail->SMTPAuth = true; $mail->Username = $settings['email_login']; $mail->Password = $settings['email_password']; $mail->SMTPSecure = 'ssl'; $mail->Port = $settings['email_port']; $mail->CharSet = "UTF-8"; // Recipients $mail -> setFrom( 'mailing@newwalls.pl', 'newwalls - zamówienie specjalne' ); $mail -> addAddress( 'studio@newwalls.pl' ); if (!empty($email)) { $mail->addAddress($email); } // Attach file if exists if (isset($_FILES['file']) && $_FILES['file']['error'] == UPLOAD_ERR_OK) { $mail->addAttachment($_FILES['file']['tmp_name'], $_FILES['file']['name']); } // Content $mail->isHTML(true); $mail->Subject = 'NEWWALLS (zamówienie specjalne)'; $mail->Body = '

Imię: ' . htmlspecialchars($name) . '

' . '

Nazwisko: ' . htmlspecialchars($surname) . '

' . '

E-mail: ' . htmlspecialchars($email) . '

' . '

Kontakt: ' . htmlspecialchars($contact_type) . '

' . '

Wiadomość: ' . nl2br(htmlspecialchars($message)) . '

'; // Success sent message alert if ($mail->send()) { echo json_encode(array('status' => 'ok', 'message' => 'Wiadomość została wysłana pomyślnie')); exit(); } else { // echo json_encode(array('status' => 'error', 'message' => 'Błąd podczas wysyłania wiadomości: ' . $mail->ErrorInfo)); // exit(); echo json_encode(array('status' => 'error', 'message' => 'Błąd podczas wysyłania wiadomości')); exit(); } } else { echo json_encode(array('status' => 'error', 'message' => 'Brak wymaganych danych')); exit(); } ?>