Jump to content


Marcão's Content

There have been 8 items by Marcão (Search limited from 20/04/2023)


Ordernar por                Order  

#909702 Enviar E-Mail Com Anexo (Atualizado!)

Posted by Marcão on 22/04/2008, 01:16 in Artigos, Dicas e Tutoriais de PHP

Qual o erro:
plotagem.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>KADNEWS | Projetando a Evolução | Fale Conosco</title>
<link href="borda.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
@import url("texto.css");
@import url("mini.css");
-->
</style>
</head>

<body bgcolor="#e4e4e4" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="200" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
	<th align="center" valign="top" nowrap="nowrap" background="kadtop2.jpg" scope="col"><table width="760" height="200" border="0" cellpadding="0" cellspacing="0">
	  <tr>
		<th scope="col"><img src="kadtop3.jpg" width="760" height="200" border="0" usemap="#Map" /></th>
	  </tr>
	</table></th>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
	<th scope="col"><table width="750" height="100%" border="0" align="center" cellpadding="0" cellspacing="5" class="borda">
	  <tr>
		<th scope="col"><form action="envia2.php" method="post" enctype="multipart/form-data" name="form2" id="form2">
		  <table width="730" border="0" cellspacing="0" cellpadding="0">
			<tr>
			  <th colspan="4" scope="col"> </th>
			  </tr>
			<tr>
			  <td colspan="2" class="subtit">Fale Conosco Plotagem: </td>
			  <td width="274" colspan="2" rowspan="11" align="right"><img src="contato.jpg" width="274" height="283" /></td>
			  </tr>
			<tr>
			  <td width="134"> </td>
			  <td> </td>
			  </tr>
			<tr>
			  <td class="texto"><div align="right">Nome:</div></td>
			  <td width="322" align="left"><label>
				<input name="nome" type="text" class="texto" id="nome" size="60" />
			  </label></td>
			  </tr>
			<tr>
			  <td class="texto"><div align="right"></div></td>
			  <td class="texto"> </td>
			  </tr>
			<tr>
			  <td class="texto"><div align="right">E-mail:</div></td>
			  <td align="left"><label>
				<input name="email" type="text" class="texto" id="email" size="60" />
			  </label></td>
			  </tr>
			<tr>
			  <td class="texto"><div align="right"></div></td>
			  <td class="texto"> </td>
			  </tr>
			<tr>
			  <td valign="top" class="texto"><div align="right">Comentário:</div></td>
			  <td align="left"><label>
				<input name="plot" type="file" class="texto" id="plot" size="48" />
			  </label></td>
			  </tr>
			<tr>
			  <td> </td>
			  <td> </td>
			  </tr>
			<tr>
			  <td> </td>
			  <td align="left"><label>
				<input name="enviar" type="submit" class="fundo" id="enviar" value="Enviar" />
			  </label></td>
			  </tr>
			<tr>
			  <td> </td>
			  <td> </td>
			  </tr>
			<tr>
			  <td valign="bottom"><div align="left"><a href="index.html" class="mini">· voltar ·</a></div></td>
			  <td> </td>
			  </tr>
			<tr>
			  <td colspan="4"> </td>
			  </tr>
		  </table>
				</form>
		</th>
	  </tr>
	</table></th>
  </tr>
</table>
<table width="100%" height="92" border="0" cellpadding="0" cellspacing="0" background="kadtop4.jpg">
  <tr>
	<th valign="bottom" scope="col"><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
	  <tr>
		<td><img src="kadtop5.jpg" width="760" height="92" border="0" usemap="#Map2" /></td>
	  </tr>
	</table></th>
  </tr>
</table>


<map name="Map" id="Map">
  <area shape="rect" coords="111,27,352,155" href="index.html" />
<area shape="rect" coords="371,162,418,186" href="index.html" />
<area shape="rect" coords="424,163,491,186" href="#" />
<area shape="rect" coords="498,162,563,189" href="kadcli.html" />
<area shape="rect" coords="676,161,740,190" href="kadfale.html" />
<area shape="rect" coords="577,162,663,187" href="kadonde.html" />
</map>
<map name="Map2" id="Map2"><area shape="rect" coords="717,22,739,45" href="http://thiagoacioli.blogspot.com" target="_blank" />
</map></body>
</html>

Envia2.php:
<?

$mail = $_POST["email"];

$message = "Nome :".$_POST["nome"]."<br>";

$message .= "E_mail :".$mail."<br>";

$message .= "Comentário :".$_POST["texto"]."<br>";

$subject = "Formulário recebido";

$anexo = $_POST["plot"];


if ($action != "upload"){

$mime_list = array("html"=>"text/html","htm"=>"text/html", "txt"=>"text/plain", "rtf"=>"text/enriched","csv"=>"text/tab-separated-values","css"=>"text/css","gif"=>"image/gif");
$ABORT = FALSE;$boundary = "XYZ-" . date(dmyhms) . "-ZYX";
$message = "--$boundary\n";
$message .= "Content-Transfer-Encoding: 8bits\n";
$message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n\n";
$message .= $body;$message .= "\n";$attachments[1] = $anexo;
foreach ($attachments as $key => $full_path) {
if ($full_path !='') {	   
if (file_exists($full_path)){			 
if ($fp = fopen($full_path,"rb")) {					 
$filename = array_pop(explode(chr(92),$full_path));					 
$contents = fread($fp,filesize($full_path));					 
$encoded = base64_encode($contents);					 
$encoded_split = chunk_split($encoded);					 
fclose($fp);					 
$message .= "--$boundary\n";					 
$message .= "Content-Type: $anexo_type\n";					 
$message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n";					 
$message .= "Content-Transfer-Encoding: base64\n\n";					 
$message .= "$encoded_split\n";			 
}			 
else {			 
echo "Impossível abrir o arquivo$key: $filename";			 
$ABORT = TRUE;			 }	   
}	   
else {	   
echo "O arquivo$key não existe: $filename";	   
$ABORT = TRUE;	   }}}
$message .= "--$boundary--\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "From: <$from>\r\n";
$headers .= "Content-type: multipart/mixed; 
boundary=\"$boundary\"\r\n";
$mensagem=mail("mzaidan@gmail.com", $subject, $message, $headers);
if ($mensagem) {	
print "Mensagem enviada!";} 
else {	print "O envio da mensagem falhou!";}}
?>



#906107 Retornar Erro

Posted by Marcão on 31/03/2008, 16:11 in PHP

Cara, acabei de falar com o cara!
Ele vai mandar só quando chegar em casa!
Vai demorar!
Mas voltando ao código, viajei aqui pq não ta pegando!



#906101 Retornar Erro

Posted by Marcão on 31/03/2008, 16:01 in PHP

Acontece que eu tirando esse $headers, o e-mail chega normal, manda até a mensagem do JavaScript!
E fazendo uma gambiarra de:

if $_POST{

mail($email1, $assunto, $corpo, $headers);

}
Dessa forma manda, não entendi o motivo que fica dando tela branca!
Não sei pq ta dando erro!

Em relação ao código que vc postou, estou sem acesso ao servidor no momento!

Mandei o codigo para um colega, ele vai mandar pro servidor e testar!
Caso chegue e-mail para vc, avise-me!



#906094 Retornar Erro

Posted by Marcão on 31/03/2008, 15:19 in PHP

Já sim!
Mas ele não ta mostrando nem o erro!
Fica tela branca!



#906063 Retornar Erro

Posted by Marcão on 31/03/2008, 13:58 in PHP

boa tarde Marcao,

coloca isso no começo do teu script

error_reporting(E_ALL);

pode ser q ele retorne algum erro, mas o que acontece com seu script? nao envia o email?


Boa tarde!
Nem envia, nem mostra que não foi enviado!
Fica a tela branca!



#906052 Retornar Erro

Posted by Marcão on 31/03/2008, 12:55 in PHP

Deu não!
Ficou tela branca!



#905956 Retornar Erro

Posted by Marcão on 31/03/2008, 00:42 in PHP

Postei acima, mudando, foi mal!
Eu ia apenas botar mais uma frase, acabei apagando a outra!



#905951 Retornar Erro

Posted by Marcão on 30/03/2008, 22:41 in PHP

<?

$mail = $_POST["email"];

$corpo = "Nome :".$_POST["nome"]."<br>";

$corpo .= "E_mail :".$mail."<br>";

$corpo .= "Comentário :".$_POST["texto"]."<br>";

$assunto = "Formulário recebido";

$email1 = "meu@email.com";

$email2 = "meu2@email.com";

$headers = "Content-type: text/html; charset=iso-8859-1\r\n";

$headers = "From: $mail";

if (mail($email1, $assunto, $corpo, $headers)){

?>

<script language="JavaScript">

alert("E-mail enviado com Sucesso");
location.href="http://www.kadnews.c...r/kadfale.php";

</script>

<?
}else{

echo "E-mail não enviado";
}

?>

Qual o erro nisso?




IPB Skin By Virteq