Email sends in Mozilla, not in IE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
calua
Forum Newbie
Posts: 1
Joined: Mon May 16, 2005 12:38 am

Email sends in Mozilla, not in IE

Post by calua »

Hello

I can't figure this out, but I have a long form that when submitted emails a copy (with three documents attached) to an email controlled by me and another provided by the user. There's javascript to check if the fields are filled proper.

The problem is that it sends both emails when the user is using firefox, and only sends one (the one provided by the user) when in IE (i'm using IE6). Since the email is done in php, this makes no sense to me. Wasan't this code be browser proof?

Well, here is the code that sends the email:

Code: Select all

<?php
	if ($_SERVER["REQUEST_METHOD"]=="POST"){
 	
		echo "<p>Enviando...</p>";

		$subject = "Ficha de Música, Feia 6";
		$from = "feia@iar.unicamp.br";
		
		$codigo_inscricao = "MU " . md5(mt_rand());

		$delimitador_mime="==" . md5(mt_rand()) . "x";
		
		$message =
		"Código de Inscrição: ".$codigo_inscricao."\r\n\r\n".

		"Grupo: ".$_POST["grupo"]."\r\n".
		"Espetáculo: ".$_POST["espetaculo"]."\r\n" .
		"Autor: ".$_POST["autor"]."\r\n" .
		"Cidade: ".$_POST["cidade"]."\r\n" .
		"Estado: ".$_POST["estado"]."\r\n\r\n";

//* the string goes on, but i'll save the space, and there's no problem in it,
//anyway, because the messages are being done correctly
		
		// builds headers
		$headers = "From: $from\r\n" .
		"MIME-Version: 1.0\r\n" .
		"Content-Type: multipart/mixed;\r\n" .
		" boundary=\"{$delimitador_mime}\"";

		// invisible part of the message
		$message = "This is a multi-part message in MIME format.\n\n" .
		"--{$delimitador_mime}\n" .
		"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
		"Content-Transfer-Encoding: 7bit\n\n" .
		$message . "\n\n";

		// processamento de arquivos uploadiados
		foreach($_FILES as $userfile){

			$tmp_name = $userfile["tmp_name"];
			$type = $userfile["type"];
			$name = $userfile["name"];
			$size = $userfile["size"];

			// se o upload funcionou, existe
			if (file_exists($tmp_name)){

				// verifica se é um arquivo uploaded mesmo, e não um arquivo de sistema
				if(is_uploaded_file($tmp_name)){

					// abre o
	        		$file = fopen($tmp_name,'rb');
	        		// lê o conteúdo do arquivo em uma variável
	        		$data = fread($file,filesize($tmp_name));
        			// fecha o arquivo
        			fclose($file);
        		
        			// agora ele e encodado e dividido em linhas de tamanhos razoáveis
        			$data = chunk_split(base64_encode($data));

	    		}

				// coloca o delimitador para indicar que começa o arquivo encaminhado.
	    		$message .= "--{$delimitador_mime}\n" .
	    		"Content-Type: {$type};\n" .
	    		" name=\"{$name}\"\n" .
	    		"Content-Disposition: attachment;\n" .
	    		" filename=\"{$fileatt_name}\"\n" .
	    		"Content-Transfer-Encoding: base64\n\n" .
	    		$data . "\n\n";
	    	
	    	}
	    
   		}
		// delimitador final, abando em --
		$message.="--{$delimitador_mime}--\n";

		$to = "caluabobo@gmail.com, ".$_POST["14_responsavel"];

		// HERE!!! DOESN'T SEND THIS
		if (@mail($to, $subject, $message, $headers)) {
		
			?>[

			<SCRIPT language="JavaScript">
			<!--
				window.location="http://www.iar.unicamp.br/feia6/inscricoes/sucesso.html";
			//-->
			</SCRIPT>
	
			<?php
		}
		else {
			?>

			<SCRIPT language="JavaScript">
			<!--
				window.location="http://www.iar.unicamp.br/feia6/inscricoes/fracasso.html";
			//-->
			</SCRIPT>

			<?php
		}

	} else {

	?>
Please help, this was supposed to be ready today, i can't find what's wrong

Oh, to see the site, go to:

http://ecos.wannabindie.com/feia/inscri ... musica.php

thank you
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

uploading the files is client-side, though. I'd say check that the upload forms are right.
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Post by thomas777neo »

The problem is that IE is a microsoft product
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

rofl.

looking at this again, what's with the [ on line 84? IE may just read that part wrong.
User avatar
thomas777neo
Forum Contributor
Posts: 214
Joined: Mon Mar 10, 2003 6:12 am
Location: Johannesburg,South Africa

Post by thomas777neo »

The else on line 105 isn't closed either. CRASH.

Are your errors turned on???
Post Reply