@JoniSuper

Проблемы с PHPMAILER?

При написании кода не пойму откуда эта ошибка:
5c21063478811430055234.png
Вот код
<<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'src/src/Exception.php';
require 'src/src/PHPMailer.php';
require 'src/src/SMTP.php';


if (isset($_POST['sub'])) {
	# code...

$mail = new PHPMailer;

 $mail->SMTPDebug = 2;                                 // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'zaharovivan098@gmail.com';                 // SMTP username
    $mail->Password = 'xxxxxxxxx';                           // SMTP password
    $mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 465;                                    // TCP port to connect to

 $mail->setFrom('zaharovivan098@gmail.com');
 $mail->addAddress('zaharovivan097@gmail.com');

 $mail->addAttachment($_FILES['file']);         // Add attachments
    $mail->addAttachment($_FILES['file']);   
    
$mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

     // Optional namefile_get_contents(
$mail->send;
  if ($mail->send) {
  	# code...
echo "1";
}
}

?>
  <form  enctype='multipart/form-data' action="test.php" method="POST">
 <input type="file" name="file[]" multiple>
      <input type="file" name="file[]" multiple>

      <input type="file" name="file[]" multiple>
      <input type="submit" name="sub">
</form>
  • Вопрос задан
  • 724 просмотра
Пригласить эксперта
Ответы на вопрос 1
alexxxst
@alexxxst
$_FILES['file'] – это массив, а ожидают строку. В тексте ошибки всё ж написано. Начать нужно с английского, потом уже в похапе.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы