How to automate emails to csv file

Status
Not open for further replies.

Ben89

New member
Mar 30, 2007
670
4
0
So let's say I get 500 emails a day to my gmail account. How can I automatically export the email addresses from those 500 emails to a .csv file on a daily basis so I can try to market other offers to them via email?

Thanks!
 


php

navigate to /mail/ (easy visual using ftp) and find the new mail folder for the account you want to do this for ... you can programmatically access all of your emails and save to db / csv. You can even delete the file when complete so you don't even have to deal with it in your inbox.

I did this a few years ago so I could take free reprint articles and use them to do my evil bidding. You just want the from: address so your project will be much simplier.
 
php

navigate to /mail/ (easy visual using ftp) and find the new mail folder for the account you want to do this for ... you can programmatically access all of your emails and save to db / csv. You can even delete the file when complete so you don't even have to deal with it in your inbox.

I did this a few years ago so I could take free reprint articles and use them to do my evil bidding. You just want the from: address so your project will be much simplier.

I don't think you can ftp to your gmail account's mail folder. If it's in a standard unix box, then it's easy. I'd write a quick sed/awk script to extract mail addresses from your mail folder. I can come up with the script for you, if you want. But with gmail ... I'm not sure. Probably gotta use their API or something. Sorry I don't know. Would like to know the answer too.

I'm already getting ideas from the OP's post. :)
 
You could configure gmail to allow pop3 access and then either write a pop client in php or download the emails to a computer using a normal pop client.

To allow POP access, go to "settings" (top right corner), then click on "forwarding and pop/imap." In the "POP Download" section click on "Enable POP for all mail " (first radio button) and save your changes.

Get the configuration instructions:Supported POP client list - Gmail Help

If you're writing your own mail client, you'll need to connect to the pop server, authenticate and download- the commands are
telnet to server, port 110 and wait for "ok"
enter "user (username)"
enter "pass (password)"
list (get a list of messages)
retr (number corresponding to message) (download the message, just prints it out)
dele (number corresponding to message)
quit

All that's kind of a hassle. So I'd use a client or other pre-written script to get the mail to my local system and then work on it from there.

Sounds like a fun project :)
 
Status
Not open for further replies.