Изменение PHP mail () на PHPMailer (deadletter.io) - PullRequest
3 голосов
/ 11 февраля 2020

Я пытаюсь настроить почтового бота с кодом, который их руководство предоставляет здесь https://deadletter.io/learn/tutorials/parcel-email/ всегда отправляет их прямо в спам.

Они упоминают об использовании PHPMailer, но не приводят пример, кто-нибудь может объяснить, как обновить этот код для использования PHPMailer

  $to = $_POST['recipient'];
  $subject = $_POST['subject'];
  $message = $_POST['message'];
  $header = "From:abc@somedomain.com \r\n";
  $header .= "MIME-Version: 1.0\r\n";
  $header .= "Content-type: text/html\r\n";

  $retval = mail ($to,$subject,$message,$header);

  if( $retval == true ) {
    echo "Message sent successfully...";
  }else {
    echo "Message could not be sent...";
  }
...