What are some common errors or pitfalls encountered when using PHPMailer for mass email sending?

Issue: One common error when using PHPMailer for mass email sending is hitting the server's email sending limits or being flagged as spam due to sending too many emails in a short period of time. To avoid this, it's important to throttle the email sending process and add delays between each email to stay within the server's limits and prevent being marked as spam.

// Throttle email sending by adding a delay between each email
$emails = array('email1@example.com', 'email2@example.com', 'email3@example.com');

foreach ($emails as $email) {
    $mail = new PHPMailer(true);
    
    // Set up PHPMailer with email details
    
    // Send email
    $mail->send();
    
    // Add a delay of 1 second between each email
    sleep(1);
}