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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check a user and display there email address???

    Hi I am really stuck on a piece of code that checks the users username and then displays there email address ?
    Any ideas?

    Sorry I mean I want to display the email inside the code to forward an email to the correct username
    for example user01@mydomain.com receives an email from user02@mydomain.com, I want the script to take the user01 and search the database for the forwarding email and then send it??
    Last edited by mike92; 12-29-2012 at 04:33 PM. Reason: Didn't explain enough

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    No...there can be no ideas until you give us something tangible to think on. We may be awesome but we are not God.

    Like give us a piece of code that you are stuck on. Or tell us to help you with the logic and give you ideas then.

  • #3
    New Coder
    Join Date
    Nov 2012
    Location
    United Kingdom
    Posts
    39
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mike92 View Post
    Hi I am really stuck on a piece of code that checks the users username and then displays there email address ?
    Any ideas?
    We can't do nothing without seeing code, but here's what i think you need:
    PHP Code:

    $username 
    "Santa";
    $query mysql_query("SELECT email FROM users WHERE username = '" $username "' LIMIT 1");
    $row mysql_fetch_assoc($query);

    echo 
    $row['email']; 

  • #4
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    The Code

    I have a pipe script which pipes the email's to PHP.
    I want to forward the email to the correct username
    for example user01@mydomain.com receives an email from user02@mydomain.com, I want the script to take the user01 and search the database for the forwarding email and then send it??

    I am really new to this bellow is a very poor attempt which I know I have all wrong..........


    PHP Code:
    // from = there email
    $from  "email@mydomain.com";
    // to = there username 
    $to ="$username";
    // me= machine host name
    $me    php_uname('n');
    // host= smtp server 
    $host  'localhost';
    // msg= the original email message
    $msg=$email;
    // forward is the email address i want to forward to  
    $forward=$data=mysql_query("SELECT * FROM users where $username='email'")
    or die (
    mysql_error ());
    $info=mysql_fetch_array($data);
    {
    echo 
    ".$info['email'];
    }
    require_once '../../SMTP.php';
    if(!($smtp = new Net_SMTP($host, 25, $me)))
      die("
    sending mail failed to initializen");
    if(PEAR::isError($smtp->connect(30)))
      die("
    sending mail failed to connectn");
    if(PEAR::isError($smtp->mailFrom($from)))
      die("
    sending mail failed to set from address [$from]n");
    if(PEAR::isError($smtp->rcptTo($to)))
      die("
    sending mail failed to set RCPT TO [$forward]n");
    if(PEAR::isError($smtp->data($msg)))
      die("
    sending mail failed to set data and sendingn");
    $smtp->disconnect(); 

    Any help would be great


  •  

    Posting Permissions

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