[PHP] Managing files on the client
Hello all: Using opendir() references directories on the server. Is there a similar function for referencing directoies on the client (browser) side? -dc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Managing files on the client
[snip] Using opendir() references directories on the server. Is there a similar function for referencing directoies on the client (browser) side? [/snip] JavaScript is client side. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] hotmail don't accept this message function any more!!
Hi, This function was working until this morning, but now I couldn't send any email to hotmail. What is the problem, any idea? == function SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles,$bcc,$m emberid,$MemberSurname,$mtype="tbl"){ $MemberId=$memberid; $MemberName=$ToName; $MemberSurname=$MemberSurname; $MemberEmail=$To; $Subject=$Subject; $MailBody=$Html; $OB="=_OuterBoundary_000"; $IB="=_InnerBoundery_001"; $Html=$Html?$Html:preg_replace("/\n/","{br}",$Text) or die("neither text nor html part present."); $Text=$Text?$Text:"Sorry, but you need an html mailer to read this mail."; $From or die("sender address missing"); $To or die("recipient address missing"); $headers ="MIME-Version: 1.0\r\n"; $headers.="From: ".$FromName." <".$From.">\n"; $headers.="To: ".$ToName." <".$To.">\n"; $headers.="Reply-To: ".$FromName." <".$From.">\n"; // $headers.="Reply-To: \n"; $headers.="X-Priority: 1\n"; $headers.="X-MSMail-Priority: High\n"; $headers.="X-Mailer: My PHP Mailer\n"; $headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n"; $headers .= "BCC:".$bcc."\n"; //Messages start with text/html alternatives in OB $Msg ="This is a multi-part message in MIME format.\n"; $Msg.="\n--".$OB."\n"; $Msg.="Content-Type: multipart/alternative;\n\tboundary=\"".$IB."\"\n\n"; //plaintext section $Msg.="\n--".$IB."\n"; $Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-9\"\n"; $Msg.="Content-Transfer-Encoding: quoted-printable\n\n"; // plaintext goes here $Msg.=$Text."\n\n"; // html section $Msg.="\n--".$IB."\n"; $Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-9\"\n"; $Msg.="Content-Transfer-Encoding: base64\n\n"; // html goes here $Msg.=chunk_split(base64_encode($Html))."\n\n"; // end of IB $Msg.="\n--".$IB."--\n"; // attachments if($AttmFiles){ foreach($AttmFiles as $AttmFile){ $patharray = explode ("/", $AttmFile); $FileName=$patharray[count($patharray)-1]; $Msg.= "\n--".$OB."\n"; $Msg.="Content-Type: application/octetstream;\n\tname=\"".$FileName."\"\n"; $Msg.="Content-Transfer-Encoding: base64\n"; $Msg.="Content-Disposition: attachment;\n\tfilename=\"".$FileName."\"\n\n"; //file goes here $fd=fopen ($AttmFile, "r"); $FileContent=fread($fd,filesize($AttmFile)); fclose ($fd); $FileContent=chunk_split(base64_encode($FileContent)); $Msg.=$FileContent; $Msg.="\n\n"; } } //message ends $Msg.="\n--".$OB."--\n"; if(mail($To,$Subject,$Msg,$headers)){ //1.test == thanks in advance rasim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] hotmail don't accept this message function any more!!
Hi, On 11/1/05, Rasim ÞEN <[EMAIL PROTECTED]> wrote: > Hi, > > This function was working until this morning, but now I couldn't send any > email to hotmail. What is the problem, any idea? > > > > > == > > > function > SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles,$bcc,$m > emberid,$MemberSurname,$mtype="tbl"){ > > $MemberId=$memberid; > $MemberName=$ToName; > $MemberSurname=$MemberSurname; > $MemberEmail=$To; > $Subject=$Subject; > $MailBody=$Html; > > $OB="=_OuterBoundary_000"; > $IB="=_InnerBoundery_001"; > $Html=$Html?$Html:preg_replace("/\n/","{br}",$Text) > or die("neither text nor html part present."); > $Text=$Text?$Text:"Sorry, but you need an html mailer to read this mail."; > $From or die("sender address missing"); > $To or die("recipient address missing"); > > $headers ="MIME-Version: 1.0\r\n"; > $headers.="From: ".$FromName." <".$From.">\n"; > $headers.="To: ".$ToName." <".$To.">\n"; > $headers.="Reply-To: ".$FromName." <".$From.">\n"; > // $headers.="Reply-To: \n"; > $headers.="X-Priority: 1\n"; > $headers.="X-MSMail-Priority: High\n"; > $headers.="X-Mailer: My PHP Mailer\n"; > $headers.="Content-Type: multipart/mixed;\n\tboundary=\"".$OB."\"\n"; > $headers .= "BCC:".$bcc."\n"; > //Messages start with text/html alternatives in OB > $Msg ="This is a multi-part message in MIME format.\n"; > $Msg.="\n--".$OB."\n"; > $Msg.="Content-Type: multipart/alternative;\n\tboundary=\"".$IB."\"\n\n"; > > //plaintext section > $Msg.="\n--".$IB."\n"; > $Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-9\"\n"; > $Msg.="Content-Transfer-Encoding: quoted-printable\n\n"; > // plaintext goes here > $Msg.=$Text."\n\n"; > > // html section > $Msg.="\n--".$IB."\n"; > $Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-9\"\n"; > $Msg.="Content-Transfer-Encoding: base64\n\n"; > // html goes here > $Msg.=chunk_split(base64_encode($Html))."\n\n"; > > // end of IB > $Msg.="\n--".$IB."--\n"; > > // attachments > if($AttmFiles){ > foreach($AttmFiles as $AttmFile){ >$patharray = explode ("/", $AttmFile); >$FileName=$patharray[count($patharray)-1]; >$Msg.= "\n--".$OB."\n"; >$Msg.="Content-Type: > application/octetstream;\n\tname=\"".$FileName."\"\n"; >$Msg.="Content-Transfer-Encoding: base64\n"; >$Msg.="Content-Disposition: > attachment;\n\tfilename=\"".$FileName."\"\n\n"; > >//file goes here >$fd=fopen ($AttmFile, "r"); >$FileContent=fread($fd,filesize($AttmFile)); >fclose ($fd); >$FileContent=chunk_split(base64_encode($FileContent)); >$Msg.=$FileContent; >$Msg.="\n\n"; > } > } > > //message ends > $Msg.="\n--".$OB."--\n"; > > if(mail($To,$Subject,$Msg,$headers)){ //1.test > > == > > > thanks in advance > rasim > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > The function works fine if you send it to a different domain? I think it's not a hotmail problem, instead, may be a configuration problem in your webserver. Saludos! Fede. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] hotmail don't accept this message function any more!!
Hello. xfedex wrote: The function works fine if you send it to a different domain? I think it's not a hotmail problem, instead, may be a configuration problem in your webserver. Saludos! Fede. I agree with Fede. On the other hand, Have you changed any setting in your Hotmail account? Have you searched for that message into the junk mail folder? -- Best regards, Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] proc_open, fwrite, 16384 bytes magic
Hi everyone, I've ran into a rather strange problem with Apache 2.0.x, PHP 4.4.0, FreeBSD. When I proc_open qmail-inject, the first 16384 bytes from a buffer are accepted perfectly, which makes it an exact 16 KB. If a buffer is larger, the rest is discarded. No errors appear anywhere - and I think I've looked just about everywhere I could think of by now. This problem does not manifest itself on a different installation of Apache 2.0.x, PHP 4.3.8, SUSE Linux, but tested against postfix, up to sizes of 95 KB. I've searched Google all over, but could not find any hints. My best guess so far is that I'm missing something in configuration directives, or it's a qmail problem - although, with qmail-inject fed via cat, everything works just fine, regardless of size. I would be grateful for any hints. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fsockopen error
I am attempting to connect to a remote server using fsockopen to post data to a php file. Here is the error i get: Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using -- disable-ipv6 option to configure) in /home/customerservice/docs/ admin_ahmed/test.php on line 37 Here is the code i am using: $reply = http_post("https://www.safetrustprocessing.com";, 80, "/ xml_order_processing.php", array("myXml" => $xml)); function http_post ($server, $port, $url, $vars) { $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"; $urlencoded = ""; while (list($key,$value) = each($vars)) $urlencoded.= urlencode($key) . "=" . urlencode($value) . "&"; $urlencoded = substr($urlencoded,0,-1); $content_length = strlen($urlencoded); $headers = "POST $url HTTP/1.1 Accept: */* Accept-Language: en-au Content-Type: application/x-www-form-urlencoded User-Agent: $user_agent Host: $server Connection: Keep-Alive Cache-Control: no-cache Content-Length: $content_length "; $fp = fsockopen($server, $port, $errno, $errstr); if (!$fp) { return false; } fputs($fp, $headers); fputs($fp, $urlencoded); $ret = ""; while (!feof($fp)) $ret.= fgets($fp, 1024); fclose($fp); return $ret; } Any ideas on the problem? Robert
[PHP] Re: Managing files on the client
No, its not possible without asking the client to install some software! dcook wrote: Hello all: Using opendir() references directories on the server. Is there a similar function for referencing directoies on the client (browser) side? -dc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning elements from array 1 not in array 2
I have two different arrays. What is the function to remove all of the elements from array 1 that are not in array 2 and return them. Array_diff seems to give me that plus ones with different values, I simply want all of the ones from one array that are not in another array and want them removed from the one array. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: returning elements from array 1 not in array 2
What is the function to remove all of the elements from array 1 that are not in array 2 and return them. Try: array_diff($arr1, array_intersect($arr1, $arr2)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question regarding Reflection
Hello All, I am developing a unit test generator for PHP. The generated tests would be PHPUnit2 compatible and I will be using the Reflection API to generate the tests. The tests would be generated only for classes and written on PHP 5.0.3 compatible. My question is to use the Reflection API, I need to import the original class for which I am generating tests. For example to generate a tests for class Company which is in Company.php: include_once('company.php'); $c = new ReflectionClass('Company'); If I have to generate test for many classes at once, it would be foolish to have them included in my file on the runtime. Am I understanding it correctly ? Thank you for your help Manish Marathe SpikeSource, Inc. http://developer.spikesource.com
Re: [PHP] proc_open, fwrite, 16384 bytes magic
Max Belushkin wrote: Hi everyone, I've ran into a rather strange problem with Apache 2.0.x, PHP 4.4.0, FreeBSD. When I proc_open qmail-inject, the first 16384 bytes from a buffer are accepted perfectly, which makes it an exact 16 KB. If a buffer is larger, the rest is discarded. No errors appear anywhere - and I think I've looked just about everywhere I could think of by now. This problem does not manifest itself on a different installation of Apache 2.0.x, PHP 4.3.8, SUSE Linux, but tested against postfix, up to sizes of 95 KB. I've searched Google all over, but could not find any hints. My best guess so far is that I'm missing something in configuration directives, or it's a qmail problem - although, with qmail-inject fed via cat, everything works just fine, regardless of size. can you proc_open() anything else and get it to accept more than 16KB ? also 4.4.1 is out. I would be grateful for any hints. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question regarding Reflection
I am developing a unit test generator for PHP. The generated tests would be PHPUnit2 compatible and I will be using the Reflection API to generate the tests. The tests would be generated only for classes and written on PHP 5.0.3 compatible. My question is to use the Reflection API, I need to import the original class for which I am generating tests. For example to generate a tests for class Company which is in Company.php: include_once('company.php'); $c = new ReflectionClass('Company'); If I have to generate test for many classes at once, it would be foolish to have them included in my file on the runtime. Am I understanding it correctly ? Thank you for your help Manish Marathe SpikeSource, Inc. http://developer.spikesource.com
[PHP] str_ireplace problems.
Greetings! I'm writing a quick and dirty tool which converts directory paths into internet friendly paths.. So converting this: C:\PHP to this: file:\\server01\share\PHP Everything else works, except this line of code.. Is there some problem I'm overlooking? My PHP skills are limited to database manipulation, so string functions other than nl2br are beyond me... The code I'm using is: //Remove the drive letter and replace it with a single slash $step1 = str_ireplace("T:\\", "\\", $_POST['path']); In context: //Remove the drive letter and replace it with a single slash $step1 = str_ireplace("T:\\", "\\", $_POST['path']); $step2 = "file:server01\\staffpub".$step1; $html = "Staff"; $result = htmlspecialchars($html); -- Fare thee well, Daniel "TheHeadSage" Spain *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ E-mail: [EMAIL PROTECTED] Mob: +61 0407 057 580 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: str_ireplace problems.
Hi, Daniel. Daniel Spain wrote: //Remove the drive letter and replace it with a single slash $step1 = str_ireplace("T:\\", "\\", $_POST['path']); $step2 = "file:server01\\staffpub".$step1; $html = "Staff"; $result = htmlspecialchars($html); Where is the definition of $step2staff? On the other hand, What's the problem? What is what you get? Do you get any error message? -- Best regards, Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: str_ireplace problems.
Daniel Spain wrote: //Remove the drive letter and replace it with a single slash $step1 = str_ireplace("T:\\", "\\", $_POST['path']); I would use: $step1 = ereg_replace(trim("^[:alpha:]"),"",$_POST['path']); This will remove the first letter of the string. You should use this, unless this letter is "T" forever. As far as I can see, this is for Windows, and the letter may change depending on the machine. On the other hand, you should verify that the user is sending you a right path. The instruction I suggested you is based on Regular Expressions. If you want to get more information about them, I suggest you: http://www.regular-expressions.info PS: If get_magic_quotes_gpc() returns true, you should use stripslashes() too: $step1 = ereg_replace(trim("^[:alpha:]"),"", stripslashes($_POST['path'])); -- Best regards, Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Managing files on the client
you could also use javascript and forms, and maybe open up an iframe with query strings probably
Re: [PHP] Re: str_ireplace problems. [Solved]
I've solved the problem. Turns out it wasn't my fault, but the other network admins... He said he installed PHP 5.. Turns out that in his mind 5 = 4. So I changed from str_ireplace to str_replace and it all works. Thanks for the website though! On 02/11/05, Gustavo Narea <[EMAIL PROTECTED]> wrote: > Daniel Spain wrote: > > //Remove the drive letter and replace it with a single slash > > $step1 = str_ireplace("T:\\", "\\", $_POST['path']); > > I would use: > $step1 = ereg_replace(trim("^[:alpha:]"),"",$_POST['path']); > > This will remove the first letter of the string. You should use this, > unless this letter is "T" forever. As far as I can see, this is for > Windows, and the letter may change depending on the machine. > > On the other hand, you should verify that the user is sending you a > right path. > > The instruction I suggested you is based on Regular Expressions. If you > want to get more information about them, I suggest you: > http://www.regular-expressions.info > > PS: If get_magic_quotes_gpc() returns true, you should use > stripslashes() too: > $step1 = ereg_replace(trim("^[:alpha:]"),"", stripslashes($_POST['path'])); > > -- > Best regards, > > Gustavo Narea. > PHP Documentation - Spanish Translation Team. > Valencia, Venezuela. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Fare thee well, Daniel "TheHeadSage" Spain *~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ E-mail: [EMAIL PROTECTED] Mob: +61 0407 057 580 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MSSQL on Linux
A few months back I wrote the list asking for help making a connection to a MS SQL database from our linux webserver. At that time I was able to make a successfull connection on Fedora Core 1 after installing php-mssql.rpm and a freetds rpm. When I upgradd to FC4, I was unable to continue my project because the RPMs had not been built for PHP5.0.4, whic is the version we run now. Today, I was able to get the version of php-mssql I needed and installed it successfully. I am able to make a connection to our ms sql server using tsql. There is a mssql.ini file in the php.d directory and the mssql.so file is in /usr/lib/php/modules/. Using the get_loaded_extensions fuction, I see that mssql is a loaded module and the phpinfo() function shows me mssql configuration files. All indicators tell me that I should be able to connect. Obvsiously, since I'm posting to the list, you can guess that it's not working. The error message I get back is useless as I'm only told that the connection failed. Does anyone know anything else I need to check to get the connection working? Upon troubleshooting, I found that there is no traffic going to database server when I used TCPDUMP. There is traffic going when I use tsql. Thank you, Robbert van Andel
[PHP] Help with new config
New server, new config. PHP 4.3.9 and new mysql db. phpmyadmin works among other scripts, including: http://compcanlit.usherbrooke.ca/whovisits.php But this bugger won't: http://testesp.flsh.usherbrooke.ca/testdb.phps http://testesp.flsh.usherbrooke.ca/phpinfo.php I cannot even see the "aa\naa It's mysql related, that is for sure. Any inspiration? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with new config
hi John You'll probably see whats up if you tell php to spit out error messages - set display_errors = 1 in php.ini hth Rob > -Original Message- > From: John Taylor-Johnston > [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 1 November 2005 12:32 PM > To: PHP-General > Subject: [PHP] Help with new config > > > New server, new config. PHP 4.3.9 and new mysql db. > > phpmyadmin works among other scripts, including: > http://compcanlit.usherbrooke.ca/whovisits.php > > But this bugger won't: > http://testesp.flsh.usherbrooke.ca/testdb.phps http://testesp.flsh.usherbrooke.ca/phpinfo.php I cannot even see the "aa\naa It's mysql related, that is for sure. Any inspiration? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question regarding Reflection
Manish Marathe wrote: Hello All, I am developing a unit test generator for PHP. The generated tests would be PHPUnit2 compatible and I will be using the Reflection API to generate the tests. The tests would be generated only for classes and written on PHP 5.0.3 compatible. My question is to use the Reflection API, I need to import the original class for which I am generating tests. For example to generate a tests for class Company which is in Company.php: include_once('company.php'); $c = new ReflectionClass('Company'); If I have to generate test for many classes at once, it would be foolish to have them included in my file on the runtime. Am I understanding it a complex app can have 100's of classes, not usually all loaded at once but still. the upper limit is depends on how much memory your generation process is allowed to grow to, how often you [need to] run it, how process-intensive it is to run the generation and how big your iron is. you might consider using forking in a master process and letting a series of child processes each handle a chunk of all the classes to generate tests for, basically running in parallel. I don't see how you can avoid loading many classes 'at once', why do you think this is foolish [by definition]? hth. correctly ? Thank you for your help Manish Marathe SpikeSource, Inc. http://developer.spikesource.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question regarding Reflection
On Tue, 01 Nov 2005 14:31:12 -0800, Manish Marathe wrote: > ... > My question is to use the Reflection API, I need to import the original > class for which I am generating tests. For example to generate a tests for > class Company which is in Company.php: > > include_once('company.php'); > > $c = new ReflectionClass('Company'); > > If I have to generate test for many classes at once, it would be foolish > to have them included in my file on the runtime. Am I understanding it > correctly ? Yes you are understanding correctly. You can avoid this issue by using the pcntl[1] tools available in php (assuming this is a *nix environment.) A simple usage would be something like: http://php.net/pcntl HTH, Curt. -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with new config
On Mon, 31 Oct 2005 21:31:51 -0500, John Taylor-Johnston wrote: > New server, new config. PHP 4.3.9 and new mysql db. > ... > > http://testesp.flsh.usherbrooke.ca/testdb.phps > http://testesp.flsh.usherbrooke.ca/phpinfo.php > > I cannot even see the "aa\naa > All I get is It's mysql related, that is for > sure. If you dont see the aa\naa that is a tell sign that you have a parse error in the script that is causing nothing to be sent to the browser. As Rob suggested, make sure you either turn on display_errors or look at the system log file (aka php.ini: logfile setting) Btw, you have a parse error on line 43: 40: }#end of while 41: 42: mysql_close($myconnection); 43: } ?> Curt -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Fsockopen error
On Tue, 01 Nov 2005 14:06:04 -0500, Robert Prentice wrote: > I am attempting to connect to a remote server using fsockopen to post data > to a php file. Here is the error i get: > > Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name > or service not known (is your IPV6 configuration correct? If this error > happens all the time, try reconfiguring PHP using -- disable-ipv6 option > to configure) in /home/customerservice/docs/ admin_ahmed/test.php on line > 37 > > Here is the code i am using: > > > $reply = http_post("https://www.safetrustprocessing.com";, 80, "/ > xml_order_processing.php", array("myXml" => $xml)); function http_post > ($server, $port, $url, $vars) { > $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"; > ... > > Any ideas on the problem? i would guess http_post() is the problem, i have no clue what it really does. Curt. -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: hotmail don't accept this message function any more!!
On Tue, 01 Nov 2005 17:54:26 +0200, Rasim ÞEN wrote: > Hi, > > This function was working until this morning, but now I couldn't send any > email to hotmail. What is the problem, any idea? Honestly, i would trust this function even if it proposed to mary me; see below. > function > SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html,$AttmFiles,$bcc,$m > emberid,$MemberSurname,$mtype="tbl"){ Way to many parameters to even consider > > $MemberId=$memberid; > $MemberName=$ToName; > $MemberSurname=$MemberSurname; > $MemberEmail=$To; > $Subject=$Subject; > $MailBody=$Html; cool, all the parameters are renamed.. oh wait only some of them, what to use... > > $OB="=_OuterBoundary_000"; > $IB="=_InnerBoundery_001"; I guess we are only attaching one file. > $Html=$Html?$Html:preg_replace("/\n/","{br}",$Text) > or die("neither text nor html part present."); all i have to say.. omg > $Text=$Text?$Text:"Sorry, but you need an html mailer to read this > mail."; $From or die("sender address missing"); $To or die("recipient > address missing"); yet more omg's > > $headers ="MIME-Version: 1.0\r\n"; > $headers.="From: ".$FromName." <".$From.">\n"; $headers.="To: ".$ToName." > <".$To.">\n"; $headers.="Reply-To: ".$FromName." <".$From.">\n"; What happens when $FromName = "l33t < lame > noobie", ditto for $ToName. > // $headers.="Reply-To: \n"; > $headers.="X-Priority: 1\n"; > $headers.="X-MSMail-Priority: High\n"; $headers.="X-Mailer: My PHP > Mailer\n"; $headers.="Content-Type: > multipart/mixed;\n\tboundary=\"".$OB."\"\n"; $headers .= > "BCC:".$bcc."\n"; Setting boundary like this is makes no sense (see above.) > //Messages start with text/html alternatives in OB $Msg ="This is a > multi-part message in MIME format.\n"; $Msg.="\n--".$OB."\n"; > $Msg.="Content-Type: multipart/alternative;\n\tboundary=\"".$IB."\"\n\n"; I find this stuff rather amusing, according to the manual it says to use \r\n as the line ending, but yet it starts with uses \n most of the time > > //plaintext section > $Msg.="\n--".$IB."\n"; > $Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-9\"\n"; Are you really sending iso-8859-9 charset? (see above about above); > $Msg.="Content-Transfer-Encoding: quoted-printable\n\n"; // plaintext > goes here > $Msg.=$Text."\n\n"; > > // html section > $Msg.="\n--".$IB."\n"; > $Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-9\"\n"; > $Msg.="Content-Transfer-Encoding: base64\n\n"; // html goes here > $Msg.=chunk_split(base64_encode($Html))."\n\n"; > > // end of IB > $Msg.="\n--".$IB."--\n"; wow, this is amazing. > > // attachments > if($AttmFiles){ > foreach($AttmFiles as $AttmFile){ >$patharray = explode ("/", $AttmFile); >$FileName=$patharray[count($patharray)-1]; $Msg.= "\n--".$OB."\n"; >$Msg.="Content-Type: > application/octetstream;\n\tname=\"".$FileName."\"\n"; >$Msg.="Content-Transfer-Encoding: base64\n"; >$Msg.="Content-Disposition: > attachment;\n\tfilename=\"".$FileName."\"\n\n"; No wonder why the arguments to this function are so complicated. > //message ends > $Msg.="\n--".$OB."--\n"; > > if(mail($To,$Subject,$Msg,$headers)){ //1.test What is $To, $Subject, $Msg, $headers? and once you know that what is the actual email that is composed and sent to the destination server? Curt. -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: proc_open, fwrite, 16384 bytes magic
On Tue, 01 Nov 2005 19:10:31 +0100, Max Belushkin wrote: >Hi everyone, > > I've ran into a rather strange problem with Apache 2.0.x, PHP 4.4.0, > FreeBSD. When I proc_open qmail-inject, the first 16384 bytes from a > buffer are accepted perfectly, which makes it an exact 16 KB. If a buffer > is larger, the rest is discarded. No errors appear anywhere - and I think > I've looked just about everywhere I could think of by now. This problem > does not manifest itself on a different installation of Apache 2.0.x, PHP > 4.3.8, SUSE Linux, but tested against postfix, up to sizes of 95 KB. If the same test fails on qmail-inject that you used with postfix, i would assume it is a configuration with qmail. Another test is to feed qmail-inject the same message you are using with the proc_open() call directly via the shell: qmai-inject < /path/to/somefile or equivalent. > I've searched Google all over, but could not find any hints. My best > guess so far is that I'm missing something in configuration directives, or > it's a qmail problem - although, with qmail-inject fed via cat, everything > works just fine, regardless of size. In this case are you sure that the file is being sent via proc_open()? can you provide a simplified script that does this? Curt. -- http://news.zirzow.dyndns.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php