Re: parsing email and puting into vars

From: Date: Mon, 23 Oct 2000 12:49:53 +0000
Subject: Re: parsing email and puting into vars
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-21776@lists.php.net to get a copy of this message
for the ones interested here is the answer: #!/usr/local/bin/php -q <? $fp = fopen('php://stdin','r'); $fout = fopen("./test.html", "w+"); fwrite($fout, "test\n"); $line=0; while(!feof($fp)) { $data=fgets($fp,4096); if ($line=="12") {$data=eregi_replace( "Subject: ", "", $data);$subject=$data;} if ($line=="17") {$content=$data;} fwrite($fout,$data); $line = $line + 1;} fwrite($fout, "\n- the end -\n"); fwrite($fout, $subject); fwrite($fout, $content); fclose($fout); fclose($fp); ?> Hi all, > a little tricky problem, i already looked in the archives, but nothing was > quite like i wanted, > maybe some of you have an idea: > here it comes: > i receive an email like this one: > ****** > From nicolas.windpassinger@sun.com Mon Oct 23 14:28:35 2000 > Received: from sun.com (localhost [127.0.0.1]) > by marchepas.France.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id OAA12608 > for <mantraq@marchepas>; Mon, 23 Oct 2000 14:28:35 +0200 (MEST) > Sender: nwindpas > Message-ID: <39F42EF3.2C1EC1A0@sun.com> > Date: Mon, 23 Oct 2000 14:28:35 +0200 > From: Nicolas Windpassinger - Sun Microsystems > <nicolas.windpassinger@sun.com> > X-Mailer: Mozilla 4.7 [en] (X11; I; SunOS 5.8 sun4u) > X-Accept-Language: en > MIME-Version: 1.0 > To: xx@marchepas.France.Sun.COM > Subject: create > Content-Type: text/plain; charset=us-ascii > Content-Transfer-Encoding: 7bit > Content-Length: 159 > > Name~example_1~ > Section~section_1~ > versionnumb~1.0~ > versiondate~2000-10-17~ > versioncomments~this page muts be created~ > versionowner~nwindpas~ > ***** > > I would like to put create into $subject, example1 into $name, section_1 > into $section, 1.0 into $versionnumb, 2000-10-17 into $versiondate, > this page muts be created into $versioncomments, and nwindpas into > $versionowner, > tx in advance for your help, > nicolas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#21776) next »