Using PHP to retrieve sender's email address from gmail inbox?

Discussion in 'PHP & Perl' started by hameem, Mar 2, 2013.

Tags:
  1. hameem

    hameem Elite Member

    Joined:
    Jul 21, 2011
    Messages:
    1,889
    Likes Received:
    988
    Location:
    221B Baker Street
    I have searched around a bit.

    I can't seem to find an element in the array returned by the PHP function "imap_fetch_overview" that will give me the email sender's email address in the inbox (or whichever folder). The "from" element gives the sender's name.

    I would appreciate it very much if anyone could help me on this.
     
  2. inviz

    inviz Newbie

    Joined:
    Jun 15, 2010
    Messages:
    45
    Likes Received:
    5
    it's (almost) impossible to help you without you providing some code.. But, you should be able to get the address if u use

    Code:
    $var = imap_headerinfo($imap, $msg);
    $fromaddr = $var->from[0]->mailbox . "@" . $var->from[0]->host;
    
    Good luck
     
  3. innozemec

    innozemec Jr. VIP Jr. VIP

    Joined:
    Aug 19, 2011
    Messages:
    5,368
    Likes Received:
    1,807
    Location:
    www.Indexification.com
    Home Page: