FForce2195 Posted October 15, 2008 Share Posted October 15, 2008 Hello. I have accomplished several goals thanks to nice people here though I've been writing PHP scripts for just 2 weeks and a few days. I have a small project to work with for the next few days. Then I'm thinking about learning how to extract Google's Gmail messages and importing them onto MySQL. Actually, I don't know if that's possible with PHP. I suppose it is. I have seen a website where they sell a library or something for extracting Gmail messages. I think I ended up with that website after asking a guy named Google or something. I also searched this place with 'Gmail extract' and didn't get precise hits. If you know where I can go to get information on accessing a Gmail account and extracting messages, please let me know. If you can give me a brief overview of what to do, that will be great, too. Thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/128513-extracting-gmail-messages-and-importing-them-onto-mysql-possible/ Share on other sites More sharing options...
MadTechie Posted October 15, 2008 Share Posted October 15, 2008 your need to readup on imap heres a basic example <?php // Connection $server = "imap.gmail.com:993"; // server & port $user = "USERNAME@gmail.com"; $pass = "PASSWORD"; $mbox = imap_open("{".$server."/imap/ssl}INBOX", $user, $pass) or die("Error: " . imap_last_error()); echo "<h1>Mailboxes</h1>\n"; $folders = imap_listmailbox($mbox, "{".$server."}", "*"); if ($folders == false) { echo "Call failed<br />\n"; } else { foreach ($folders as $val) { echo $val . "<br />\n"; } } echo "<h1>Headers in INBOX</h1>\n"; $headers = imap_headers($mbox); if ($headers == false) { echo "Call failed<br />\n"; } else { foreach ($headers as $val) { echo $val . "<br />\n"; } } imap_close($mbox); ?> Quote Link to comment https://forums.phpfreaks.com/topic/128513-extracting-gmail-messages-and-importing-them-onto-mysql-possible/#findComment-666013 Share on other sites More sharing options...
FForce2195 Posted October 16, 2008 Author Share Posted October 16, 2008 Whoa... That's very nice. Thanks a lot, MadTechie. Quote Link to comment https://forums.phpfreaks.com/topic/128513-extracting-gmail-messages-and-importing-them-onto-mysql-possible/#findComment-666650 Share on other sites More sharing options...
MadTechie Posted October 16, 2008 Share Posted October 16, 2008 Well its a starting point i won't write the whole thing but that should give you a jump start.. as a side note.. i have a static IP at home and at the office but i hear theirs a problem with using gmails imap on a server with a dynamic external IP.. (just something to keep in mind) Quote Link to comment https://forums.phpfreaks.com/topic/128513-extracting-gmail-messages-and-importing-them-onto-mysql-possible/#findComment-666655 Share on other sites More sharing options...
FForce2195 Posted October 16, 2008 Author Share Posted October 16, 2008 Okay. Thanks for the reminder, MadTechie. Quote Link to comment https://forums.phpfreaks.com/topic/128513-extracting-gmail-messages-and-importing-them-onto-mysql-possible/#findComment-666677 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.