Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Parameter into Variable

    I am trying to grab the "fromaddress" of every email that comes into a certain inbox. Is there an easy way to display this value without writing a line of code for each message number?

    PHP Code:
    $from imap_header($mbox1);
    echo 
    "$from->fromaddress <br />";
        
    $from imap_header($mbox2);
    echo 
    "$from->fromaddress <br />"
    Additionally, how do I turn a specific "fromaddress" into a variable?
    Last edited by cosmoray; 05-21-2011 at 05:42 PM.

  • #2
    Regular Coder
    Join Date
    May 2011
    Posts
    240
    Thanks
    1
    Thanked 56 Times in 55 Posts
    Try this (change MAILSERVER.DOMAIN.COM, EMAIL, PASSWORD).

    PHP Code:
    <?php
    $mbox 
    imap_open("{MAILSERVER.DOMAIN.COM:143/imap/novalidate-cert}INBOX""EMAIL""PASSWORD"); 
    $totalrows imap_num_msg($mbox);
    for (
    $i 1$i <= $totalrows$i++)
    {
            
    $header imap_header($mbox$i);
            
    $from $header->fromaddress;
            if ((
    $pos strpos($from"<")) !== false)
            {
                    
    $from substr($from$pos+1);
                    
    $from substr($from0, -1);
            }
            echo 
    $from "\n";
    }

  • Users who have thanked gvre for this post:

    cosmoray (05-21-2011)

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Works perfectly, thanks for the help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •