Formularz phpmailer problem

0

Cześć chcę zrobić prosty formularz kontaktowy z wykorzystaniem php mailer'a tylko , że nic się nie dzieje ani żadnego errora ani nie pokazuje się , że się wiadomość wysłała nie wiem gdzie jest błąd.

<?php
  use PHPMailer\PHPMailer\PHPMailer;
  use PHPMailer\PHPMailer\SMTP;
  require 'vendor/autoload.php';

  function send_mail($config) {
    $mail = new PHPMailer;
    
    //$mail->SMTPDebug = 3;                               // Enable verbose debug output
    $mail->setLanguage('pl');
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp.mailtrap.io';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = '13507a23867099';                 // SMTP username
    $mail->Password = 'e4cbeab85cc124';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to
    
    $mail->setFrom('[email protected]', 'Mailer');
    $mail->addAddress('[email protected]', 'Joe User');     // Add a recipient
    $mail->addReplyTo($config['mailFrom'], 'Information');
    
    $mail->isHTML(true);                                  // Set email format to HTML
    
    $mail->Subject = $config['mailSubject'];
    $mail->Body    = $config['mailContent'];
    $mail->AltBody = $config['mailContent'];
  }
  if(isset($_POST['submit'])) {
    $config = [
      'mailFrom' => $_POST['mailFrom'],
      'mailSubject' =>  $_POST['mailSubject'],
      'mailContent' =>  $_POST['mailContent'],
    ]; 
    send_mail($config);
  }
?>
<form id="contact" class="form-contact" action="" method="post">
      <label for="mail-mail">Email</label>
      <input type="email" class="form-control" id="mail-mail" aria-describedby="emailHelp" name="mailFrom" placeholder="Wprowadź e-mail"
        required>
      <label for="subject-mail">Temat</label>
      <input type="text" id="subject-mail" class="form-control" placeholder="Wprowadź temat" name="mailSubject">
      <label for="content-mail">Treść</label>
      <textarea class="form-control" placeholder="Wprowadź treść e-mail'a" name="mailContent" id="content-mail" cols="20"
        rows="5"></textarea>
      <button type="submit" name="submit" class="btn btn-primary btn-form">Wyślij</button>
      
    </form>
2

Nie widzę tu nigdzie wywołania funkcji send : $mail->send()

0

No tak ... musiałem podczas przenoszenia źle wyciąć dzięki za pomoc już śmiga ;D

0 użytkowników online, w tym zalogowanych: 0, gości: 0