<?php
use PHPMailer\PHPMailer\PHPMailer;
require 'PHPMailer/src/Exception.php'; 
require 'PHPMailer/src/PHPMailer.php';
require 'PHPMailer/src/SMTP.php';
$mail = new PHPMailer(true); 

try { 
$mail->SMTPDebug = 0;
$mail->isSMTP(); 
$mail->Host = 'mail.r10.net'; // mail host
$mail->SMTPAuth = true; 
$mail->Username = 'info@example.net'; // gönderen kullanıcı adı
$mail->Password = 'MyStrongPassword!'; // gönderen mail şifre
$mail->SMTPSecure = 'TLS'; 
$mail->Port = 587;
$mail->setFrom('info@example.net'); // gönderen adı
$mail->addAddress($_POST['mail']);

$mail->Subject = $_POST['subject']; 
$mail->Body = $_POST['text']; 
$mail->send();
} 
catch (Exception $e) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; }
?>
<form action="testform.php" method="POST">        
<input type="text" name="mail" class="form-control" placeholder="Email Address">
<input type="text" name="subject" class="form-control" placeholder="Subject">
<textarea class="form-control" name="text" rows="3" placeholder="Your Message"></textarea>                
<button class="btn btn-default" type="submit">Send Message</button>      
</form>
PHPMailer kütüphanesini projenize eklemeniz gerekiyor.