Hallo,

I use the Mercury/32 Mail Transport System for my local mail generated by PHP 4.3x.

I use Apache 1.328 as webserver on a windows 2000 workstation.

The whole configuration is used as a testing server.
So far so good...🙂
I have a mail form with attachement which is send with a mime mail script. The whole script / page nworks very well on my reomote (linux) server. On my local server i get a server and a PHP error (a system error). The normal mail() function with out mime works on the local server too.

What can be wrong?

    Please post the code and and the error message(s) you get.

    Thomas

      Hallo Thomas,

      this is what i get from windows:

      Application popup: php.exe - Application Error : The instruction at "0x1009defe" referenced memory at "0x00000000". The memory could not be "read".

      and inside my browser there is 500 error created by apache.

      I use this class to mail the form:
      http://www.phpclasses.org/browse/package/1077.html

        Ok,

        seems to be a null pointer exception. This might be hard to resolve. Some steps:

        1. Try to use another class like phpmailer.sourceforge.net, a very powerful mail class.
        2. Try to reconfigure Apache to use PHP as Apache module instead as CGI (download the zipped version of PHP if you used the installer version of PHP before):

        a. comment out any configuration directive related to PHP
        b. Add
        LoadModule php4_module "c:/path/top/php4/sapi/php4apache.dll"
        to httpd.conf
        c. Add
        AddModule mod_php4.c
        to httpd.conf
        d. Add the lines
        AddType application/x-httpd-php .php .phtml
        AddType application/x-htppd-php-source .phps
        to httpd.conf
        e. make sure to copy php4ts.dll and libmysql.dll to system32
        f. make sure that a valid php.ini exists in the windows/winnt directory
        g. restart apache

        1. Install PHP 5 and test the scripts with PHP 5
        2. Might be some overkill: try to find the lines in the PHP source (c/c++) that cause that exception and try to find a solution for it.

        Edit: php 4.3.9 has been released ... upgrade and check if that solves the problem (some crash issues have been fixed)

        Thomas

          Thomas,

          these are a lot of changes in my configuartion ... is it possible for you to send mimemail on a system like mine?

          edit:
          i use this configuartion because it's nearly the same like my remote. Maybe i should do some upgrade like apache 2.0 and php 4.38. I had the same error with postcast several month before. I will keep you informed...thanks.

            maybe that this is imporant:

            I run php in fast cgi mode...

              I am using apache 2.0.50/PHP 4.3.8 as Apache module and don't have any problems sending mimemail. I'll change the configuration to check if any problems occur when running PHP in CGI mode.

              Did you try the phpmailer class ?

              Thomas

                No,

                i don't think that the problem is inside the class. I use a lot of different mime-mail functions written by myself and the error occurs everytime on my localhost. On all linux webhosts is everthing OK.

                  Please post one of the functions you wrote yourself so I can try to reproduce the problem on my system.

                  Thomas

                    this script is based on someone's example an get some modifications:

                    	if (empty($from) || empty($subject) || empty($message) || empty($emaillist)) {
                    		echo "<script>alert(\"Please complete all fields before sending your message.\");</script>";
                    	} else {
                    		// optimalisation message and subject
                    		$message = urlencode($message);
                    		$message = ereg_replace("%5C%22", "%22", $message);
                    		$message = urldecode($message);
                    		$message = stripslashes($message);
                    		$subject = stripslashes($subject);
                    		// convert textarea to single mail addresses
                    		$allemails = split("\n", $emaillist);
                    		$numemails = count($allemails);
                    		#Open the file attachment if any, and base64_encode it for email transport
                    		if (isset($file) && ($file != "")) {
                    			$tmp_file = $DOCUMENT_ROOT."/extra/tmp/".$_FILES['file']['name'];
                    			@copy($file, $tmp_file) or die("The file you are trying to upload couldn't be copied to the server");
                    			system("chmod 755 $tmp_file");
                    			$content = fread(fopen($tmp_file,"r"),filesize($tmp_file));
                    			$content = chunk_split(base64_encode($content));
                    			$uid = md5(uniqid(time()));
                    			$name = basename($tmp_file);
                    		}
                    		for($y=0; $y<$numemails; $y++) {
                    			$to = $allemails[$y];
                    			if ($to) {
                    				$to = ereg_replace(" ", "", $to);
                    				$message = ereg_replace("&email&", $to, $message);
                    				$subject = ereg_replace("&email&", $to, $subject);
                    				echo "Sending mail to $to.......";
                    				flush();
                    				$header = "From: $realname <$from>\r\nReply-To: $replyto\r\n";
                    				$header .= "MIME-Version: 1.0\r\n";
                    				if (isset($file) && ($file != "")) {
                    					$header .= "Content-Type: multipart/mixed; boundary=$uid\r\n";
                    					$header .= "--$uid\r\n";
                    				}
                    				$header .= "Mailer: myPHPemailer 1.0\r\n";
                    				$header .= "Content-type:text/plain;charset=euc-kr\r\n";
                    				$header .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
                    				$header .= "$message\r\n";
                    				if (isset($file) && ($file != "")) {
                    					$header .= "--$uid\r\n";
                    					$header .= "Content-Type: \"application/octet-stream\"; name=\"$name\"\r\n";
                    					$header .= "Content-Transfer-Encoding: base64\r\n";
                    					$header .= "Content-Disposition: attachment; filename=\"$name\"\r\n";
                    					$header .= "$content\r\n\r\n";
                    					$header .= "--$uid--";
                    				}
                    				mail($to, $subject, "", $header);
                    				echo "<img src='images/success.gif'><br>";
                    				flush();
                    			}
                    		}
                    	}
                    	if (isset($file) && ($file != "")) {
                    		unlink($file);
                    	}
                    
                      Write a Reply...