What functions can be used in PHP to interact with email servers?
To interact with email servers in PHP, you can use functions such as `mail()` to send emails, `imap_open()` to connect to an IMAP server, `imap_search()` to search for emails, and `imap_fetchbody()` to retrieve the body of an email.
// Example of sending an email using the mail() function
$to = "recipient@example.com";
$subject = "Test Email";
$message = "This is a test email.";
$headers = "From: sender@example.com";
// Send email
$mailSent = mail($to, $subject, $message, $headers);
if($mailSent){
echo "Email sent successfully.";
} else {
echo "Failed to send email.";
}