Mail2PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lukas

    Mail2PHP

    I want to send an email directly to a directory on my server
    what script do I need to do this?
    Maybe I should add a line to my aliases file like this: emailaddress:
    "|/usr/bin/email2directory " ?
    Thanks for some suggestions


  • Brian McGarvie

    #2
    Re: Mail2PHP

    in your aliases enter a line such as:

    mailprog: "|/usr/local/bin/php /path/to/your/file.php"

    The below script will read the entire email recieved and store it in $buffer
    for you do do what you want with it...

    <?php
    define('STDIN', fopen("php://stdin","r"));
    //define('STDIN', fopen("dev/stdin","r"));
    $str = fgets(STDIN);

    $fp = popen('cat /dev/fd/0','r');
    while(!feof($fp )) {
    $lines = fgets($fp,4096) ."\n";
    }

    $handle = STDIN;
    while (!feof ($handle)) {
    $buffer .= fgets($handle, 4096);
    echo $buffer;
    }
    fclose ($handle);

    // Rest of Script to manipulate the recieved email...

    ?>

    HTH,

    Brian...

    "Lukas" <Lukas@verwijde rdit.be> wrote in message
    news:3f056991$0 $287$ba620e4c@r eader0.news.sky net.be...[color=blue]
    > I want to send an email directly to a directory on my server
    > what script do I need to do this?
    > Maybe I should add a line to my aliases file like this: emailaddress:
    > "|/usr/bin/email2directory " ?
    > Thanks for some suggestions
    >
    >[/color]


    Comment

    • Lukas

      #3
      Re: Mail2PHP


      "Brian McGarvie" <brian.mcgarvie @nospam.anypurp oseloans.co.uk> schreef in
      bericht news:be4a1c$e05 $1@sparta.btint ernet.com...[color=blue]
      > in your aliases enter a line such as:
      >
      > mailprog: "|/usr/local/bin/php /path/to/your/file.php"[/color]
      where can I find the exact path of php? It's not on this location :-(


      Comment

      • Ian.H [dS]

        #4
        Re: Mail2PHP


        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        Whilst lounging around on Sat, 5 Jul 2003 11:35:09 +0200, "Lukas"
        <Lukas@verwijde rdit.be> amazingly managed to produce the following
        with their Etch-A-Sketch:
        [color=blue]
        >
        > "Brian McGarvie" <brian.mcgarvie @nospam.anypurp oseloans.co.uk>
        > schreef in bericht news:be4a1c$e05 $1@sparta.btint ernet.com...[color=green]
        > > in your aliases enter a line such as:
        > >
        > > mailprog: "|/usr/local/bin/php /path/to/your/file.php"[/color]
        > where can I find the exact path of php? It's not on this location
        > :-(
        >[/color]


        $ locate php

        or

        $ find / -name php



        HTH.


        Regards,

        Ian

        -----BEGIN PGP SIGNATURE-----
        Version: PGP 8.0

        iQA/AwUBPwaiT2fqtj2 51CDhEQIT8ACeOJ G5Bco26og5etX+y P5oMJ6SkjsAmweB
        q5yo5advPNid9F+ Pe3xg5giS
        =fZ+V
        -----END PGP SIGNATURE-----

        --
        Ian.H [Design & Development]
        digiServ Network - Web solutions
        www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
        Programming, Web design, development & hosting.

        Comment

        • Lukas

          #5
          Re: Mail2PHP


          "Ian.H [dS]" <ian@WINDOZEdig iserv.net> schreef in bericht
          news:2h8dgvkfj8 bfheiabvl8eur1c bjpjvap50@4ax.c om...[color=blue]
          >
          > -----BEGIN PGP SIGNED MESSAGE-----
          > Hash: SHA1
          >
          > Whilst lounging around on Sat, 5 Jul 2003 11:35:09 +0200, "Lukas"
          > <Lukas@verwijde rdit.be> amazingly managed to produce the following
          > with their Etch-A-Sketch:
          >[color=green]
          > >
          > > "Brian McGarvie" <brian.mcgarvie @nospam.anypurp oseloans.co.uk>
          > > schreef in bericht news:be4a1c$e05 $1@sparta.btint ernet.com...[color=darkred]
          > > > in your aliases enter a line such as:
          > > >
          > > > mailprog: "|/usr/local/bin/php /path/to/your/file.php"[/color]
          > > where can I find the exact path of php? It's not on this location
          > > :-(
          > >[/color]
          >
          >
          > $ locate php
          >
          > or
          >
          > $ find / -name php[/color]
          %locate php
          /usr/local/www/bin/php-config
          /usr/local/www/bin/phpextdist
          /usr/local/www/bin/phpize
          /usr/local/www/etc/php.ini-dist
          /usr/local/www/include/php
          /usr/local/www/include/php/TSRM
          /usr/local/www/include/php/TSRM/TSRM.h
          /usr/local/www/include/php/TSRM/acconfig.h
          /usr/local/www/include/php/TSRM/readdir.h
          /usr/local/www/include/php/TSRM/tsrm_config.h
          /usr/local/www/include/php/TSRM/tsrm_config.w32 .h
          /usr/local/www/include/php/TSRM/tsrm_config_com mon.h
          /usr/local/www/include/php/TSRM/tsrm_strtok_r.h
          /usr/local/www/include/php/TSRM/tsrm_virtual_cw d.h
          /usr/local/www/include/php/TSRM/tsrm_win32.h
          /usr/local/www/include/php/Zend
          /usr/local/www/include/php/Zend/-ZENDSHIT-
          /usr/local/www/include/php/acconfig.h
          /usr/local/www/include/php/ext
          /usr/local/www/include/php/ext/standard
          /usr/local/www/include/php/ext/standard/-STANDARDSHIT-
          /usr/local/www/include/php/ext/xml
          /usr/local/www/include/php/ext/xml/-XMLSHIT-
          /usr/local/www/include/php/main
          /usr/local/www/include/php/main/-MAINSHIT-
          /usr/local/www/include/php/php_version.h
          /usr/local/www/include/php/regex
          /usr/local/www/include/php/regex/-REGEXSHIT-
          /usr/local/www/lib/php
          /usr/local/www/lib/php/Benchmark
          /usr/local/www/lib/php/Benchmark/Iterate.php
          /usr/local/www/lib/php/Benchmark/Timer.php
          /usr/local/www/lib/php/Cache
          /usr/local/www/lib/php/Cache/-CACHESHIT-
          /usr/local/www/lib/php/Console
          /usr/local/www/lib/php/Console/Getopt.php
          /usr/local/www/lib/php/Crypt
          /usr/local/www/lib/php/Crypt/CBC.php
          /usr/local/www/lib/php/Crypt/HCEMD5.php
          /usr/local/www/lib/php/DB
          /usr/local/www/lib/php/DB/-DBSHIT-
          /usr/local/www/lib/php/Date
          /usr/local/www/lib/php/Date/Calc.php
          /usr/local/www/lib/php/Date/Human.php
          /usr/local/www/lib/php/File
          /usr/local/www/lib/php/File/Find.php
          /usr/local/www/lib/php/File/Passwd.php
          /usr/local/www/lib/php/File/SearchReplace.p hp
          /usr/local/www/lib/php/HTML
          /usr/local/www/lib/php/HTML/Common.php
          /usr/local/www/lib/php/HTML/Form.php
          /usr/local/www/lib/php/HTML/IT.php
          /usr/local/www/lib/php/HTML/ITX.php
          /usr/local/www/lib/php/HTML/Page.php
          /usr/local/www/lib/php/HTML/Processor.php
          /usr/local/www/lib/php/HTML/Select.php
          /usr/local/www/lib/php/HTML/Table.php
          /usr/local/www/lib/php/HTTP
          /usr/local/www/lib/php/HTTP/Compress.php
          /usr/local/www/lib/php/HTTP.php
          /usr/local/www/lib/php/Image
          /usr/local/www/lib/php/Image/Remote.php
          /usr/local/www/lib/php/Log
          /usr/local/www/lib/php/Log/composite.php
          /usr/local/www/lib/php/Log/file.php
          /usr/local/www/lib/php/Log/mcal.php
          /usr/local/www/lib/php/Log/observer.php
          /usr/local/www/lib/php/Log/sql.php
          /usr/local/www/lib/php/Log/syslog.php
          /usr/local/www/lib/php/Log.php
          /usr/local/www/lib/php/Mail
          /usr/local/www/lib/php/Mail/RFC822.php
          /usr/local/www/lib/php/Mail/sendmail.php
          /usr/local/www/lib/php/Mail/smtp.php
          /usr/local/www/lib/php/Mail.php
          /usr/local/www/lib/php/Math
          /usr/local/www/lib/php/Math/Fraction.php
          /usr/local/www/lib/php/Math/Util.php
          /usr/local/www/lib/php/Net
          /usr/local/www/lib/php/Net/Curl.php
          /usr/local/www/lib/php/Net/Dig.php
          /usr/local/www/lib/php/Net/SMTP.php
          /usr/local/www/lib/php/Net/Socket.php
          /usr/local/www/lib/php/Numbers
          /usr/local/www/lib/php/Numbers/Roman.php
          /usr/local/www/lib/php/PEAR
          /usr/local/www/lib/php/PEAR/Common.php
          /usr/local/www/lib/php/PEAR/Installer.php
          /usr/local/www/lib/php/PEAR/Packager.php
          /usr/local/www/lib/php/PEAR/Uploader.php
          /usr/local/www/lib/php/PEAR.php
          /usr/local/www/lib/php/Payment
          /usr/local/www/lib/php/Payment/Verisign.php
          /usr/local/www/lib/php/Schedule
          /usr/local/www/lib/php/Schedule/At.php
          /usr/local/www/lib/php/XML
          /usr/local/www/lib/php/XML/Parser.php
          /usr/local/www/lib/php/XML/RPC
          /usr/local/www/lib/php/XML/RPC/Server.php
          /usr/local/www/lib/php/XML/RPC.php
          /usr/local/www/lib/php/build
          /usr/local/www/lib/php/build/acinclude.m4
          /usr/local/www/lib/php/build/dynlib.m4
          /usr/local/www/lib/php/build/dynlib.mk
          /usr/local/www/lib/php/build/fastgen.sh
          /usr/local/www/lib/php/build/library.mk
          /usr/local/www/lib/php/build/ltlib.mk
          /usr/local/www/lib/php/build/mkdep.awk
          /usr/local/www/lib/php/build/pear.m4
          /usr/local/www/lib/php/build/program.mk
          /usr/local/www/lib/php/build/rules.mk
          /usr/local/www/lib/php/build/rules_common.mk
          /usr/local/www/lib/php/build/rules_pear.mk
          /usr/local/www/lib/php/build/shtool
          /usr/local/www/libexec/libphp4.so
          /var/db/pkg/mod_php4-4.0.6_5
          /var/db/pkg/mod_php4-4.0.6_5/+COMMENT
          /var/db/pkg/mod_php4-4.0.6_5/+CONTENTS
          /var/db/pkg/mod_php4-4.0.6_5/+DESC
          /var/db/pkg/mod_php4-4.0.6_5/+DISPLAY
          /var/db/pkg/phpMyAdmin-2.1.0
          /var/db/pkg/phpMyAdmin-2.1.0/+COMMENT
          /var/db/pkg/phpMyAdmin-2.1.0/+CONTENTS
          /var/db/pkg/phpMyAdmin-2.1.0/+DESC


          Comment

          • Lukas

            #6
            Re: Mail2PHP


            "Joshua Ghiloni" <jdg11@SPAM.ME. AND.DIE.cwru.ed u> schreef in bericht
            news:be6um6$b8h $1@eeyore.INS.c wru.edu...[color=blue]
            > Lukas wrote:[color=green]
            > > "Ian.H [dS]" <ian@WINDOZEdig iserv.net> schreef in bericht
            > > news:2h8dgvkfj8 bfheiabvl8eur1c bjpjvap50@4ax.c om...
            > >[color=darkred]
            > >>-----BEGIN PGP SIGNED MESSAGE-----
            > >>Hash: SHA1
            > >>
            > >>Whilst lounging around on Sat, 5 Jul 2003 11:35:09 +0200, "Lukas"
            > >><Lukas@verwij derdit.be> amazingly managed to produce the following
            > >>with their Etch-A-Sketch:
            > >>
            > >>
            > >>>"Brian McGarvie" <brian.mcgarvie @nospam.anypurp oseloans.co.uk>
            > >>>schreef in bericht news:be4a1c$e05 $1@sparta.btint ernet.com...
            > >>>
            > >>>>in your aliases enter a line such as:
            > >>>>
            > >>>>mailprog: "|/usr/local/bin/php /path/to/your/file.php"
            > >>>
            > >>>where can I find the exact path of php? It's not on this location
            > >>>:-(
            > >>>[/color][/color]
            >
            > [ snip lots of places php was found ]
            >
            > You could also try $ which php
            > If that doesn't return anything then either a) php isn't in your path or
            > b) you don't have it installed as a binary, only a module.[/color]

            Last login: Sat Jul 5 13:09:23 2003 from deurne.ox.be
            Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
            The Regents of the University of California. All rights reserved.
            FreeBSD 4.4-RELEASE (SERVER) #0: Wed Aug 28 19:41:18 GMT 2002
            %which php
            php: Command not found.
            %

            bad luck? Other options for my problem?


            Comment

            • Ken Robinson

              #7
              Re: Mail2PHP

              "Lukas" <Lukas@verwijde rdit.be> wrote in
              news:3f07463f$0 $289$ba620e4c@r eader0.news.sky net.be:
              [color=blue]
              >
              > "Joshua Ghiloni" <jdg11@SPAM.ME. AND.DIE.cwru.ed u> schreef in bericht
              > news:be6um6$b8h $1@eeyore.INS.c wru.edu...[/color]

              [snip]
              [color=blue]
              >
              > Last login: Sat Jul 5 13:09:23 2003 from deurne.ox.be
              > Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
              > The Regents of the University of California. All rights
              > reserved.
              > FreeBSD 4.4-RELEASE (SERVER) #0: Wed Aug 28 19:41:18 GMT 2002
              > %which php
              > php: Command not found.
              > %[/color]

              That should be

              where php


              try that...

              Ken Robinson

              Comment

              • Ian.H [dS]

                #8
                Re: Mail2PHP

                -----BEGIN PGP SIGNED MESSAGE-----
                Hash: SHA1

                Whilst lounging around on Sun, 06 Jul 2003 10:56:24 GMT, Ken Robinson
                <sendspamhere@r bnsn.com> amazingly managed to produce the following
                with their Etch-A-Sketch:
                [color=blue][color=green]
                > > %which php
                > > php: Command not found.
                > > %[/color]
                >
                > That should be
                >
                > where php
                >
                >
                > try that...
                >
                > Ken Robinson[/color]


                [tk@morris:~]$ where php
                bash: where: command not found

                [tk@morris:~]$ which php
                [tk@morris:~]$



                Are you sure?

                I get no results from 'which' as PHP isn't installed as a binary, but
                results are still better than 'where' as shown by:


                [tk@morris:~]$ which perl
                /usr/bin/perl




                Regards,

                Ian

                -----BEGIN PGP SIGNATURE-----
                Version: PGP 8.0

                iQA/AwUBPwhVOGfqtj2 51CDhEQJI6wCgwC yOhsa8pnEx23kWB 51iVVDrjGsAoMwK
                Dy7bnzitBBaTMIu JHx4euzm+
                =Kv3M
                -----END PGP SIGNATURE-----

                --
                Ian.H [Design & Development]
                digiServ Network - Web solutions
                www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
                Programming, Web design, development & hosting.

                Comment

                • Ken Robinson

                  #9
                  Re: Mail2PHP

                  "Ian.H [dS]" <ian@WINDOZEdig iserv.net> wrote in
                  news:08lggvkl1a mmvvlng08or343c 6j2v8qb7p@4ax.c om:
                  [color=blue]
                  > -----BEGIN PGP SIGNED MESSAGE-----
                  > Hash: SHA1
                  >
                  > Whilst lounging around on Sun, 06 Jul 2003 10:56:24 GMT, Ken Robinson
                  > <sendspamhere@r bnsn.com> amazingly managed to produce the following
                  > with their Etch-A-Sketch:
                  >[color=green][color=darkred]
                  >> > %which php
                  >> > php: Command not found.
                  >> > %[/color]
                  >>
                  >> That should be
                  >>
                  >> where php
                  >>
                  >>
                  >> try that...
                  >>
                  >> Ken Robinson[/color]
                  >
                  >
                  > [tk@morris:~]$ where php
                  > bash: where: command not found
                  >
                  > [tk@morris:~]$ which php
                  > [tk@morris:~]$[/color]


                  Sorry,

                  It should be

                  whereis php

                  Here's the output from a Linux box:

                  bash-2.05$ whereis php
                  php: /usr/bin/php /usr/lib/php /usr/local/bin/php /usr/local/lib/php
                  /usr/local/lib/php.ini /usr/include/php

                  Ken

                  Comment

                  • Lukas

                    #10
                    Re: Mail2PHP


                    "Ken Robinson" <sendspamhere@r bnsn.com> schreef in bericht
                    news:445d876745 776d519e9831619 c601b98@TeraNew s...[color=blue]
                    > "Ian.H [dS]" <ian@WINDOZEdig iserv.net> wrote in
                    > news:08lggvkl1a mmvvlng08or343c 6j2v8qb7p@4ax.c om:
                    >[color=green]
                    > > -----BEGIN PGP SIGNED MESSAGE-----
                    > > Hash: SHA1
                    > >
                    > > Whilst lounging around on Sun, 06 Jul 2003 10:56:24 GMT, Ken Robinson
                    > > <sendspamhere@r bnsn.com> amazingly managed to produce the following
                    > > with their Etch-A-Sketch:
                    > >[color=darkred]
                    > >> > %which php
                    > >> > php: Command not found.
                    > >> > %
                    > >>
                    > >> That should be
                    > >>
                    > >> where php
                    > >>
                    > >>
                    > >> try that...
                    > >>
                    > >> Ken Robinson[/color]
                    > >
                    > >
                    > > [tk@morris:~]$ where php
                    > > bash: where: command not found
                    > >
                    > > [tk@morris:~]$ which php
                    > > [tk@morris:~]$[/color]
                    >
                    >
                    > Sorry,
                    >
                    > It should be
                    >
                    > whereis php
                    >
                    > Here's the output from a Linux box:
                    >
                    > bash-2.05$ whereis php
                    > php: /usr/bin/php /usr/lib/php /usr/local/bin/php /usr/local/lib/php
                    > /usr/local/lib/php.ini /usr/include/php[/color]

                    I get /usr/ports/lang/php
                    when I mail to this alias I get:
                    ############### ############### ############### #######
                    ----- The following addresses had permanent fatal errors -----
                    "|/usr/ports/lang/php /www/htdocs/php/do.php"
                    (reason: 126)
                    (expanded from: <php@oxcamp.com >)

                    ----- Transcript of session follows -----
                    /usr/ports/lang/php: permission denied
                    554 5.3.0 unknown mailer error 126
                    ############### ############### ############### #######
                    Does this mean that the mail user does not have permission to read
                    /usr/ports/lang/php
                    or that it doesn't have permission to read/write in the /www/htdocs/php/
                    dir?

                    Thanks


                    Comment

                    • Ian.H [dS]

                      #11
                      Re: Mail2PHP

                      -----BEGIN PGP SIGNED MESSAGE-----
                      Hash: SHA1

                      Whilst lounging around on Mon, 7 Jul 2003 02:36:58 +0200, "Lukas"
                      <Lukas@verwijde rdit.be> amazingly managed to produce the following
                      with their Etch-A-Sketch:
                      [color=blue]
                      > I get /usr/ports/lang/php
                      > when I mail to this alias I get:
                      > ############### ############### ############### #######
                      > ----- The following addresses had permanent fatal errors -----
                      > "|/usr/ports/lang/php /www/htdocs/php/do.php"
                      > (reason: 126)
                      > (expanded from: <php@oxcamp.com >)
                      >
                      > ----- Transcript of session follows -----
                      > /usr/ports/lang/php: permission denied
                      > 554 5.3.0 unknown mailer error 126
                      > ############### ############### ############### #######
                      > Does this mean that the mail user does not have permission to read
                      > /usr/ports/lang/php
                      > or that it doesn't have permission to read/write in the
                      > /www/htdocs/php/ dir?
                      >
                      > Thanks[/color]


                      Ahh good ol' FreeBSD ports 8)

                      They're nothing more than a few text files and Makefile(s).

                      I've got to suspect, that like me, your PHP install is as an Apache
                      module rather than a binary, hence what you're attempting to do in
                      PHP isn't gonna happen unless you reinstall PHP as a binary.



                      Regards,

                      Ian

                      -----BEGIN PGP SIGNATURE-----
                      Version: PGP 8.0

                      iQA/AwUBPwlLzGfqtj2 51CDhEQI+IQCbB4 r0pLwGEbAMBAZjv TPO7hmqbX4AoNmU
                      QaDXs4XTCiBZEze 8x/Axdkx8
                      =Kxdw
                      -----END PGP SIGNATURE-----

                      --
                      Ian.H [Design & Development]
                      digiServ Network - Web solutions
                      www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
                      Programming, Web design, development & hosting.

                      Comment

                      Working...