Hi guys -

Okay we have a database (created a while back) that contains user information such as name, email, address, phone etc. AND a field that says whether they would like to be contacted via email or not.

Now we have another text file with over 5,000 email addresses (each on a separate line) that lists email addresses of users that would like to be contacted via the newsletter.

Problem: There might be duplicates in this text file AND duplicates of email addresses in the database already.

This is what I would like to do:

Write a PHP script that goes through the database and writes to a text file all the email addresses that would like to be contacted.
Next it should go through the other text file we have, REMOVE duplicate email addrs., and then write the emails to the new text file we just created.

This way we have a text file with email addresses of all users from both the database and the 5,000 entry text file.

Now I would like to use this text file to send a mail out to all users...simple mail script I guess.

Would appreciate suggestions on how to tackle this problem. Would also appreciate any code that people could submit for me to get going with this.

(After doing all this, I will make a small addition to the database script that will write the email address of any user that selects YES - to be contacted - to this new text file. This will allow me to simply use a generic mail script to email users.)

Thanks in advance!