SMTPDebug = 0; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = 'example@gmail.com'; $mail->Password = '********'; $mail->SMTPSecure = 'tls'; $mail->Port = 587; //Recipients $mail->setFrom('example@gmail.com', 'My Name'); $mail->addAddress('recipient@example.com'); //Content $mail->isHTML(true); $mail->Subject = 'Test Email'; $mail->Body = 'This is a test email sent using PHPMailer!'; $mail->AltBody = 'This is the plain text version of the email'; $mail->send(); echo 'Email message has been sent successfully!'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?>This example uses the PHPMailer package to send an email. It also includes the SMTP authentication credentials for Gmail. The script sets the email subject, body, and recipient addresses using the PHPMailer methods. If the email is sent successfully, the script outputs a success message; otherwise, it outputs an error message.