What are the advantages and disadvantages of storing email addresses in a text file for newsletter distribution in PHP?

Storing email addresses in a text file for newsletter distribution in PHP can be a simple and cost-effective solution. However, it may not be the most secure method as text files can be easily accessed and manipulated. It is important to ensure that the text file is properly secured to prevent any unauthorized access to the email addresses.

// Example of storing email addresses in a text file for newsletter distribution
$file = 'emails.txt';

// Add new email address to the text file
$email = 'example@email.com';
file_put_contents($file, $email . PHP_EOL, FILE_APPEND);

// Retrieve email addresses from the text file
$emails = file($file, FILE_IGNORE_NEW_LINES);
foreach($emails as $email) {
    echo $email . '<br>';
}