What are some potential pitfalls to be aware of when sending emails through PHP in Joomla?

One potential pitfall when sending emails through PHP in Joomla is that the emails may end up in the recipient's spam folder due to improper email headers. To avoid this, make sure to set the appropriate headers such as "From", "Reply-To", and "Content-Type" in your PHP code.

// Set email headers to prevent emails from going to spam folder
$headers = 'From: Your Name <your_email@example.com>' . "\r\n";
$headers .= 'Reply-To: Your Name <your_email@example.com>' . "\r\n";
$headers .= 'Content-Type: text/html; charset=ISO-8859-1' . "\r\n";

// Send email using PHP mail function
mail($to, $subject, $message, $headers);