4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: steveeyes on December 19, 2005, 07:47:17 AM

Title: Export Emails to csv
Post by: steveeyes 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

Title: Re: Export Emails to csv
Post by: steveeyes on December 19, 2005, 04:34:04 PM
Any help, please
Title: Re: Export Emails to csv
Post by: TheOracle 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.
Title: Re: Export Emails to csv
Post by: steveeyes 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
Title: Re: Export Emails to csv
Post by: TheOracle on December 26, 2005, 08:12:55 PM
PM replied. ;)
Title: Re: Export Emails to csv
Post by: impss on December 26, 2005, 09:15:48 PM
TheOracle, I have the same problem

PM sent
Title: Re: Export Emails to csv
Post by: TheOracle on December 26, 2005, 09:16:37 PM
PM Received. ;)
Title: Re: Export Emails to csv
Post by: impss on December 30, 2005, 06:41:04 PM
Can Anyone else make this mod? Maybe like a plugin for the Admin CP

thanks
Title: Re: Export Emails to csv
Post by: Acidgod 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...
Title: Re: Export Emails to csv
Post by: impss 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
Title: Re: Export Emails to csv
Post by: Acidgod 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...
Title: Re: Export Emails to csv
Post by: impss on December 30, 2005, 07:56:19 PM
Thats even better  8)

Thanks again
Title: Re: Export Emails to csv
Post by: Acidgod 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:
Title: Re: Export Emails to csv
Post by: impss on December 30, 2005, 08:07:59 PM
 :wink:
Title: Re: Export Emails to csv
Post by: TheOracle 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();
?>



;)
Title: Re: Export Emails to csv
Post by: Knuty on February 16, 2006, 07:44:38 PM
Working perfect like a norwegian girl :)
Title: Re: Export Emails to csv
Post by: TheOracle on February 16, 2006, 07:51:12 PM
Quote

a norwegian girl


Now, that's one good example. :mrgreen:
Title: Re: Export Emails to csv
Post by: Brainwrek on August 23, 2006, 11:02:11 PM
This looks OUTSTANDING!

I would like to modify it to retrieve all sender & recipient email addresses from the ecards.  I tried the following code, but it crashes out.

Code: [Select]
<?php // PLUGIN_TITLE: Ecard Emails

$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("""postcard_recipient_email"). get_user_table_field(", ""postcard_sender_email")."
FROM "
.POSTCARDS_TABLE."";
//WHERE user_allowemails = '1'"; 

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

if (
$anz) {

$fp = @fopen('all-ecard-addresses/list.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/all-ecard-addresses/list.csv")."\">".$lang['download']."</a>";

###### End of if statement.

show_admin_footer();
?>

The error for the above code is:
Quote
DB Error: Bad SQL Query: SELECT FROM 4users
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM 4users' at line 2

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/stick/public_html/ecards/includes/db_mysql.php on line 116

Still investigating, but would appreciate any help you could provide.  Thanks!!!

Special thanks to TheOracle!
Title: Re: Export Emails to csv
Post by: Brainwrek on August 23, 2006, 11:14:31 PM
This looks OUTSTANDING!

I would like to modify it to retrieve all sender & recipient email addresses from the ecards.  I tried the following code, but it crashes out.

Code: [Select]
<?php // PLUGIN_TITLE: Ecard Emails

$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("""postcard_recipient_email"). get_user_table_field(", ""postcard_sender_email")."
FROM "
.POSTCARDS_TABLE."";
//WHERE user_allowemails = '1'"; 

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

if (
$anz) {

$fp = @fopen('all-ecard-addresses/list.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/all-ecard-addresses/list.csv")."\">".$lang['download']."</a>";

###### End of if statement.

show_admin_footer();
?>

The error for the above code is:
Quote
DB Error: Bad SQL Query: SELECT FROM 4postcards
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM 4postcards' at line 2

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/stick/public_html/ecards/includes/db_mysql.php on line 116

Still investigating, but would appreciate any help you could provide.  Thanks!!!

Special thanks to TheOracle!
Title: Re: Export Emails to csv
Post by: Brainwrek on August 24, 2006, 07:34:37 AM
Ok...

With valuable help from TheOracle (thank you!), this is working very well for extracting the emails from ecards.  Here's the code I'm using:
Code: [Select]
<?php // PLUGIN_TITLE: Ecard Emails

$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 postcard_recipient_email, postcard_sender_email
FROM "
.POSTCARDS_TABLE."";

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

if (
$anz) {

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

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

@fclose($fp); 

echo 
"<a href=\"".$site_sess->url(ROOT_PATH_ADMIN."plugins/addresses/emails.csv")."\">Download</a>";

###### End of if statement.

show_admin_footer();
?>