What information is needed to properly configure PHPMailer-Lite for sending emails?
To properly configure PHPMailer-Lite for sending emails, you will need to provide the following information: 1. SMTP server address 2. SMTP username 3. SMTP password 4. SMTP port (usually 587 or 465) 5. From email address Here is an example PHP code snippet to configure PHPMailer-Lite for sending emails:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.example.com';
$mail->SMTPAuth = true;
$mail->Username = 'your_smtp_username';
$mail->Password = 'your_smtp_password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('from@example.com', 'Your Name');
$mail->addAddress('recipient@example.com', 'Recipient Name');
$mail->isHTML(true);
$mail->Subject = 'Subject of the email';
$mail->Body = 'Body of the email';
try {
$mail->send();
echo 'Email sent successfully';
} catch (Exception $e) {
echo 'Email could not be sent. Mailer Error: ' . $mail->ErrorInfo;
}