// SMTP configuration $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = 'your_email@gmail.com'; $mail->Password = 'your_password'; $mail->SMTPSecure = 'tls'; $mail->Port = 587;
// Send email $to = 'recipient_email@example.com'; $subject = 'Test Email'; $message = 'This is a test email.'; $headers = 'From: your_email@example.com'; if (mail($to, $subject, $message, $headers)) { echo 'Email sent successfully.'; } else { echo 'Failed to send email.'; }This code example shows how to send an email using the built-in PHP mail function. It does not require any external package library. However, it requires the server to have an email server installed and configured properly. Overall, depending on the email requirements, different package libraries can be used for PHP email configuration. Some popular ones include PHPMailer, SwiftMailer, and Zend Mail.