x10Hosting Forums

Corporate Free Hosting for the Masses.



Register

Reply
 
LinkBack Thread Tools Display Modes
I love the internet

vigge_sWe's Avatar

Join Date: Oct 2007
Posts: 2,705
Credits: 8,759
vigge_sWe has a reputation beyond reputevigge_sWe has a reputation beyond repute
Location: Göteborg, Sweden

Quote  
08-18-2008, 09:42 AM
[PHP and mySQL]Emails to outlook

Have you ever wanted to import the emails from your site to your outlook. Like if you are running a newsletter and want to use outlook to send the letter. Here is an easy way to export all emails into outlook:

Create a php file with this:

PHP Code:
<?php
// set database server access variables:
$host "localhost";
$user "USERNAME";
$pass "PASSWORD";
$db "DATABASE"

// open connection
$connection mysql_connect($host$user$pass) or die ("Unable to connect!"); 

// select database
mysql_select_db($db) or die ("Unable to select database!"); 

// create query
$query "SELECT * FROM FIELD";

// execute query
$result mysql_query($query) or die ("Error in query: $query. ".mysql_error()); 

// see if any rows were returned
if (mysql_num_rows($result) > 0) {
    
// yes
    // print them one after another
    
while($row mysql_fetch_row($result)) {
        echo 
"".$row[0].";<br />";
    }
}
else {
    
// no
    // print status message
    
echo "No rows found!";
}

// free result set memory
mysql_free_result($result);

// close connection
mysql_close($connection);  
?>
Edit USERNAME, PASSWORD, DATABASE and FIELD (// create query
$query = "SELECT * FROM FIELD".

ALSO:
PHP Code:
echo "".$row[0].";<br />"
change the 0 to the row with the emails. If the row with emails is row 3 (example), change the 0 to a 4. 0 is the first row, 1 is the second, 2 is the third and so on

this is gonna echo a list like this

mail@mail.tld;
mail2@mail2.tld;
/.../

Copy this into a text document.
Now open outlook and choose import>other adressbook.
Then choose "textdocument".
Done!

I am pretty sure this will work because it worked for me.
__________________
Reply With Quote
vigge_sWe is offlineReport Post
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 05:43 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

MPAA | Loans | Credit Cards | Mortgages | Promotional Codes