// create PHPMailer object $mail = new PHPMailer(true); try { $mail->setFrom('sender@example.com', 'Sender Name'); $mail->addAddress('recipient@example.com', 'Recipient Name'); $mail->Subject = 'Subject'; $mail->Body = 'Email body'; $mail->AltBody = 'Email body in plain text'; // attempt to send email $mail->send(); // check if an error occurred during the email sending process if ($mail->IsError()) { echo 'An error occurred: ' . $mail->ErrorInfo; } else { echo 'Email sent successfully'; } } catch (Exception $e) { echo 'Error: ' . $e->getMessage(); }
// create PHPMailer object $mail = new PHPMailer(true); // get the package library information $package = $mail->getVersion(); // display the package library information echo 'PHPMailer version ' . $package['version'] . ' (' . $package['type'] . '), developed by ' . $package['author'];In this example, the getVersion method is used to retrieve the package library information, which is then displayed on the screen.