开发者

email address extraction [closed]

It&开发者_Go百科#39;s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I would like a php script, i imagine it will need sql for storage, that logs in to my gmail goes through all my emails and extracts the to from and cc and the email addresses within the text of the email, from forwarded and multiply forwarded emails, and tags them as where the came from ie to from cc and inline.

whats the best way to go about it i have no idea where to start


Here's a pseudocode using PHP - each step should be simple enough to implement on its own.

  • connect to database using the mysqli extension
  • log into gmail using the imap extension and its functions
    • get a list of folders
    • for each folder
      • get a list of messages, and their headers
      • for each message (you may want to check and reject obvious spam here)
      • get message headers and body
      • look for the From: To: CC: and BCC: headers
      • store those into database (those are your tags)
      • use a regular expression to match possible e-mail addresses
      • if matches found:
        • store them into database, linked with the tags
  • disconnect from gmail
  • disconnect from database


This should be a good place to start:

http://code.google.com/apis/gmail/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜