PHPMailer is more reliable than PHP's mail(), and works well on shared hosting without Composer.
Steps:
1. Download PHPMailer ZIP here
2. Upload the folder to your host (e.g. /phpmailer/)
3. Use this sample code:
<?php
use PHPMailer\PHPMailer\PHPMailer;
require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = 'your_email_server';
$mail->SMTPAuth = true;
$mail->Username = 'your_email@example.com';
$mail->Password = 'your_app_password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('your_email@example.com', 'Your Name');
$mail->addAddress('recipient@example.com');
$mail->Subject = 'Test Email';
$mail->Body = 'Hello, this is a test email sent via PHPMailer on shared hosting.';
echo $mail->send() ? "Sent!" : "Error: ".$mail->ErrorInfo;
?>
PHPMailer + SMTP ensures better deliverability, supports HTML emails and attachments