Extract email using php

Discussion in 'PHP' started by dordor, Jan 12, 2011.

  1. #1
    Hi guys,

    I want to extract email messages using php and insert them into my sql.

    I used this script
    http://www.weberdev.com/get_example-4015.html

    It works BUT, instead of getting just the subject line and the body, I got tons of other fields that were not related

    like

    [17] => h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type;

    [18] => b=37JwJRXx1CsFsNIbviCsViSmJHNBhOE1ed/dSh1qO9YnZQZgoFaqLDyTepInVY/gdPVWOOCF3hxc1Pmn+NVwmFpUifWXYih8L6728jkA0JRMo+YBTwdzqNr6XskF55xTL+zVWcSsv9fPSk3FFYVjeX6SvrTpqSLM5bZLB+YrTI8=;

    Any idea how to extract only from, date, subject and body into mysql??

    THanks!
     
    dordor, Jan 12, 2011 IP
  2. underground-stockholm

    underground-stockholm Guest

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Write a loop that goes through the array and creates a new array with only the fields that you want.
     
    underground-stockholm, Jan 13, 2011 IP
  3. dordor

    dordor Active Member

    Messages:
    385
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    68
    #3
    but the fields changes from server to server.
    I don't know how to catch only the fields that I want.
    Any ideas?
     
    dordor, Jan 14, 2011 IP
  4. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #4
    Use preg_match !
     
    ssmm987, Jan 14, 2011 IP