Results 1 to 7 of 7

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Aug:2008
    Location: Burgas
    Posts: 24

    . . . . "" "=C9=C9=C9" .. . . .
    #!/usr/local/bin/php -q
    <?php
    // Initialize variables
    $from = "";
    $to = "";
    $allheaders = "";
    $otherheaders = "";
    $emailfeed = "";
    $message = "";
    $splittingheaders = true;
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/plain; charset=UTF-8' . "\r\n";

    // Get the email from stdin
    $fd = fopen("php://stdin", "r");
    $email = "";
    while (!feof($fd)) {
    $email .= fread($fd, 1024);
    }
    fclose($fd);

    // Parse the email line by line into an array
    $lines = explode("\n", $email);

    // For each of the lines in the email
    for ($i=0; $i<count($lines); $i++) {
    // If we are separating the headers out from the message body
    if ($splittingheaders) {
    $allheaders .= $lines[$i]."\n";

    // Look out for special headers
    if (preg_match("/^from: (.*)/i", $lines[$i], $matches)) {
    $from = $matches[1];
    $fromEmail = ereg("([[:alnum:]_\.\-]+@([[:alnum:]_\.\ -]+\.)+[[:alpha:]]{2,4})", $from, $emailMatch);
    $fromEmail = $emailMatch[1];
    }
    elseif (preg_match("/^to: (.*)/i", $lines[$i], $matches)) {
    $to = $matches[1];
    }
    else {
    $otherheaders .= $lines[$i]."\n";
    }
    }
    else{ // Add this line to the message body
    $message .= $lines[$i]."\n";
    if (preg_match("/^emailfeed: (.*)/i", $lines[$i], $matches)) {
    $emailfeed = $matches[1];
    }
    else {
    $otherheaders .= $lines[$i]."\n";
    }
    }

    // If the line is blank
    if (trim($lines[$i])=="") {
    // The header section has ended
    $splittingheaders = false;
    }
    }
    // If the user isn't from our domain and hasn't sent too many recent emails
    if(!strpos($from, '@xxx.com')) {
    // Then send an autoresponse back to the user
    mail("$from", "", "$emailfeed", "$headers");
    }
    ?>
    Last edited by kukata; 29th July 2011 at 15:59.

  2. #2
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , deja-vu, 1:1 ... .

  3. #3
    Registered User
    Join Date: Aug:2008
    Location: Burgas
    Posts: 24
    . , . ,

  4. #4
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    ?
    Code:
    $fd = fopen("php://stdin", "rb");

  5. #5
    Registered User
    Join Date: Aug:2008
    Location: Burgas
    Posts: 24
    ,

  6. #6
    ! vbTheKing's Avatar
    Join Date: Sep:2003
    Location:
    Posts: 4,138
    fclose($fd) :
    echo '<pre>'; var_dump($email); exit;
    [ CODE ] [/ CODE ]

    EDIT:>> ? , , :
    $fp = fopen('email.txt', 'w');
    $dump = print_r($email, true);
    fwrite($fp, $dump);
    fclose($fp); exit;
    Last edited by vbTheKing; 29th July 2011 at 19:17.
    ''? * *
    - !
    ...

  7. #7
    Registered User
    Join Date: Aug:2008
    Location: Burgas
    Posts: 24
    . Mail Delivery Error. -" ". PIPE to program: . CPanel-a . .
    Code:
    This message was created automatically by mail delivery software.
    
    A message that you sent could not be delivered to one or more of its
    recipients. This is a permanent error. The following address(es) failed:
    
     pipe to |/home/xxxx/respond.php
       generated by admin@xxxx.com
    
    The following text was generated during the delivery attempt:
    
    ------ pipe to |/home/xxxx/respond.php
          generated by admin@xxxx.com ------
    
    <pre>string(1389) "From xxxx@gmail.com Fri Jul 29 19:14:13 2011
    Received: from mail-gx0-f170.google.com ([209.85.161.170])
           by more.superhosting.bg with esmtps (TLSv1:RC4-MD5:128)
           (Exim 4.69)
           (envelope-from <xxxx@gmail.com>)
           id 1QmphU-0002sL-Gs
           for admin@xxxx.com; Fri, 29 Jul 2011 19:14:12 +0300
    Received: by gxk27 with SMTP id 27so2955913gxk.15
           for <admin@xxxx.com>; Fri, 29 Jul 2011 09:14:08 -0700 (PDT)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
           d=gmail.com; s=gamma;
           h=mime-version:from:date:message-id:subject:to:content-type
            :content-transfer-encoding;
           bh=2xYzp4Wl3Xpx28dpkNcQ7uKt1aeH4bbHNxsI7+5pYlo=;
           b=oQeU7yCWoemxYNRyHfeP5fziFof+O1mApAM06mIU3ztd1soasQwAS81EpCtzcflBCP
            22Zp0+98w7T7yxIN8sRIGjccO9CFTc5qwBjPbv4uIlhcJOtvhBKvaI1JeDebD5dibteK
            2mOiav9/hK3jHkzsxuG6KZOkpQwriPCdf2JTY=
    Received: by 10.42.151.131 with SMTP id e3mr1065900icw.507.1311956048156; Fri,
     29 Jul 2011 09:14:08 -0700 (PDT)
    MIME-Version: 1.0
    Received: by 10.231.13.200 with HTTP; Fri, 29 Jul 2011 09:13:48 -0700 (PDT)
    From: <xxxx@gmail.com>
    Date: Fri, 29 Jul 2011 19:13:48 +0300
    Message-ID: <CAMgNFCdaCgitttB2Av3nPGb5eSa3zosWUk3iDbeSD4S=jbZL0Q@mail.gmail.com>
    Subject:
    To:<admin@xxxx.com>
    Content-Type: text/plain; charset=KOI8-R
    Content-Transfer-Encoding: quoted-printable
    
    imeifamiliq: =D8=D1=C1
    
    "
    
    ------ This is a copy of the message, including all the headers. ------
    
    Return-path: <xxxx@gmail.com>
    Received: from mail-gx0-f170.google.com ([209.85.161.170])
           by more.superhosting.bg with esmtps (TLSv1:RC4-MD5:128)
           (Exim 4.69)
           (envelope-from <xxxx@gmail.com>)
           id 1QmphU-0002sL-Gs
           for admin@xxxx.com; Fri, 29 Jul 2011 19:14:12 +0300
    Received: by gxk27 with SMTP id 27so2955913gxk.15
           for <admin@xxxx.com>; Fri, 29 Jul 2011 09:14:08 -0700 (PDT)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
           d=gmail.com; s=gamma;
           h=mime-version:from:date:message-id:subject:to:content-type
            :content-transfer-encoding;
           bh=2xYzp4Wl3Xpx28dpkNcQ7uKt1aeH4bbHNxsI7+5pYlo=;
           b=oQeU7yCWoemxYNRyHfeP5fziFof+O1mApAM06mIU3ztd1soasQwAS81EpCtzcflBCP
            22Zp0+98w7T7yxIN8sRIGjccO9CFTc5qwBjPbv4uIlhcJOtvhBKvaI1JeDebD5dibteK
            2mOiav9/hK3jHkzsxuG6KZOkpQwriPCdf2JTY=
    Received: by 10.42.151.131 with SMTP id e3mr1065900icw.507.1311956048156; Fri,
     29 Jul 2011 09:14:08 -0700 (PDT)
    MIME-Version: 1.0
    Received: by 10.231.13.200 with HTTP; Fri, 29 Jul 2011 09:13:48 -0700 (PDT)
    From:<xxxx@gmail.com>
    Date: Fri, 29 Jul 2011 19:13:48 +0300
    Message-ID: <CAMgNFCdaCgitttB2Av3nPGb5eSa3zosWUk3iDbeSD4S=jbZL0Q@mail.gmail.com>
    Subject:
    To:<admin@xxxx.com>
    Content-Type: text/plain; charset=KOI8-R
    Content-Transfer-Encoding: quoted-printable
    imeifamiliq: ( )
    imeifamiliq: =D8=D1=C1

    --------- 19:36 --------- : 19:24 ---------

    . . .

    --------- 20:03 --------- : 19:36 ---------

    UTF-8 :
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: base64

    aW1laWZhbWlsaXE6INGP0LAK <<<<<<<
    windows-1251.
    . KIO8-R. UTF-8

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |