I’m currently using the Simplenews Drupal module for creating and sending newsletters. My client requested that the subscriber export function be changed to export all subscriber details to CSV. As the export option already retrieves all subscriber emails and generates a comma seperated string, exporting to CSV only requires a few extra lines of php.

After the following piece of code:

// Build form field containing exported emails.
// The field will be included in the form where at the ['emails'] place holder.
if (isset($mails)) {
$exported_mails = implode(", ", $mails);

else {
$exported_mails = t('No addresses were found.');

Add the following:

header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=subscribers.csv");
print $exported_mails;