Author Topic: Export Emails to csv  (Read 18580 times)

0 Members and 1 Guest are viewing this topic.

Offline steveeyes

  • Full Member
  • ***
  • Posts: 177
    • View Profile
Export Emails to csv
« on: December 19, 2005, 07:47:17 AM »
I use the 4images usergroup mod. It's great to be able to separate your usergroups and email them, etc.

However, as my memberships have grown, I have been forced to search out another way to email my members. The reason being is that my server only allows me to send 50 emails at a time -- and now it is taking too long to send out newsletters.

I thought at one time I saw this mod by V@NO but maybe I'm wrong. I searched but didn't find anything.

I'm hoping an expert could tell me the code to extract the emails by usergroups into csv format or another format that can be imported into a newsletter program.

I have two usergroups ... one called Ladies and the other Called Men

I would like to extract the Usergroup Ladies emails and then import them into a  mailing list that would also be called Ladies.

The same thing for the Men Usergroup -- extract emails from usergroup and import into mailing list called men

Any help would be appreciated.

Thanks
Steve


Offline steveeyes

  • Full Member
  • ***
  • Posts: 177
    • View Profile
Re: Export Emails to csv
« Reply #1 on: December 19, 2005, 04:34:04 PM »
Any help, please

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Export Emails to csv
« Reply #2 on: December 25, 2005, 02:01:39 PM »
@Steveeyes:

Since yesterday, your MOD has been completely done and fully tested. You may PM me if you wish to have it.

Merry Christmas.

Offline steveeyes

  • Full Member
  • ***
  • Posts: 177
    • View Profile
Re: Export Emails to csv
« Reply #3 on: December 26, 2005, 07:54:52 PM »
Thank you sir, thank you sir. Not sure if you got my PM, but your efforts are appreciated.

Merry Christmas
Steve

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Export Emails to csv
« Reply #4 on: December 26, 2005, 08:12:55 PM »
PM replied. ;)

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: Export Emails to csv
« Reply #5 on: December 26, 2005, 09:15:48 PM »
TheOracle, I have the same problem

PM sent

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Export Emails to csv
« Reply #6 on: December 26, 2005, 09:16:37 PM »
PM Received. ;)

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: Export Emails to csv
« Reply #7 on: December 30, 2005, 06:41:04 PM »
Can Anyone else make this mod? Maybe like a plugin for the Admin CP

thanks

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Export Emails to csv
« Reply #8 on: December 30, 2005, 07:30:22 PM »
Code: [Select]
<?php // PLUGIN_TITLE: email to csv
$nozip 1;
define('IN_CP'1);
define('ROOT_PATH'"./../../");
define('ROOT_PATH_ADMIN'"./../");
require(
ROOT_PATH_ADMIN.'admin_global.php');


$anzahl 0

global 
$site_db
$sql "SELECT user_email, user_name
FROM "
.USERS_TABLE."
WHERE user_allowemails=1"

$result $site_db->query($sql);
$anz mysql_num_rows ($result); 

$fp=fopen('emails/adressen.csv','w+'); 

while (
$sql_array mysql_fetch_array($resultMYSQL_NUM)) 

$text implode(' ; '$sql_array) . " ; \n"
fwrite($fp,$text); 


fclose($fp); 

print 
"<a href=\"".ROOT_PATH_ADMIN."plugins/emails/adressen.csv\">Download</a>";

?>

create a folder emails with chmod 777  into the plugin folder...
after use you found a csv file in the folder with the emails form the users that allows mails from the admin...

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: Export Emails to csv
« Reply #9 on: December 30, 2005, 07:46:57 PM »
Thanks Acidgod

That worked perfectly  8)

U saved me a bunch of time not having to send 50 emails at a time

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Export Emails to csv
« Reply #10 on: December 30, 2005, 07:49:57 PM »
have make a littel modification, now there is a link to the csv file at the end of the script...

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: Export Emails to csv
« Reply #11 on: December 30, 2005, 07:56:19 PM »
Thats even better  8)

Thanks again

Offline Acidgod

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Export Emails to csv
« Reply #12 on: December 30, 2005, 08:02:08 PM »
please rename the email folder or the cvs file in the plugin... 
or put a htaccess file in the email folder... (o:

Here:
$fp=fopen('emails/adressen.csv','w+');

And here:
print "<a href=\"".ROOT_PATH_ADMIN."plugins/emails/adressen.csv\">Download</a>";

otherwise anyone can grab the List of emails... (o:

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: Export Emails to csv
« Reply #13 on: December 30, 2005, 08:07:59 PM »
 :wink:

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Export Emails to csv
« Reply #14 on: February 16, 2006, 06:50:55 PM »
@Acidgod:

I just noticed some unusual codings in your plugin. Modifications has just been made as I hope you won't mind :

Code: [Select]

<?php // PLUGIN_TITLE: email to csv

$nozip 1;
define('IN_CP'1);
define('ROOT_PATH'"./../../");
define('ROOT_PATH_ADMIN'"./../");
require(
ROOT_PATH_ADMIN.'admin_global.php');

show_admin_header();

$anzahl 0

$sql "

SELECT "
.get_user_table_field("""user_name"). get_user_table_field(", ""user_email")."
FROM "
.USERS_TABLE."
WHERE user_allowemails = '1'

"


$result $site_db->query($sql);
$anz $site_db->get_numrows($result); 

if (
$anz) {

$fp = @fopen('emails/adressen.csv''w+'); 

while (
$sql_array $site_db->fetch_array($resultMYSQL_NUM)) { 
$text implode(' ; '$sql_array) . " ; \n"
@
fwrite ($fp$text); 
###### End of while statement.

@fclose($fp); 

echo 
"<a href=\"".$site_sess->url(ROOT_PATH_ADMIN."plugins/emails/adressen.csv")."\">".$lang['download']."</a>";

###### End of if statement.

show_admin_footer();
?>



;)
« Last Edit: February 16, 2006, 07:07:25 PM by TheOracle »