Pow Pessoal estou com o seguinte problema, tenho um formulario que necessito anexar um arquivo, porém eu envio o form mas não chega nada na minha caixa de emails e não sei de fato se o arquivo foi anexado.
estou fazendo desta forma:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="favicon.ico">
<meta http-equiv="Content-Type" content="text/html
charset=utf-8" />
<title>Oportunidades</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="total"><!--inicio div total-->
<div id="topo"> <!--inicio div topo-->
<div id="logo">
<img src="imagens/tecmautlogo2.fw.png" width="300px" height="100px" >
</div>
</div><!--final div topo-->
<div class="menu" ><!--inicio div menu-->
<ul id="nav">
<li class="current"><a href="index.html">Pagina inicial</a></li>
<li><a href="quemsomos.html">Quem somos</a>
<!-- <ul>
<li><a href="#">Teste</a></li>
<li><a href="#">JS / jQuery</a>
<ul>
<li><a href="#">jQuery</a></li>
<li><a href="#">JS</a></li>
</ul>
</li>
<li><a href="#">PHP</a></li>
<li><a href="#">MySQL</a></li>
<li><a href="#">XSLT</a></li>
<li><a href="#">Ajax</a></li>
</ul>
</li>-->
<li><a href="#">Serviços</a>
<ul>
<li><a href="automacao.html">Automação</a>
<!--<ul>
<li><a href="#">PHP</a></li>
<li><a href="#">MySQL</a></li>
<li><a href="#">XSLT</a></li>
<li><a href="#">Ajax</a></li>
</ul>-->
</li>
<li><a href="pressurizacao.html">Pressurização</a>
<!--<ul>
<li><a href="#">captcha</a></li>
<li><a href="#/">gallery</a></li>
<li><a href="#">animation</a></li>
</ul>-->
</li>
</ul>
</li>
<li><a href="clientes.html">Principais clientes </a></li>
<li><a href="parceiros.html">Parceiros</a></li>
<li><a href="oportunidades.html">Trabalhe conosco</a></li>
<li><a href="contatos.html">Contatos</a></li>
</ul>
</div><!--final div meu-->
<div id="conteudo"><!--inicio div conteudo-->
<div id="esquerda">
<h4>Vagas disponíveis</h4>
<br>
<br>
<br>
<br>
<h5>No momento não há vagas</h5>
</div>
<div id="centro" class="container">
<h3>Trabalhe conosco</h3>
<form action="rh.php" method="post" name="oportunidade" target="_self">
Nome:
<input name="Nome" type="text" required="required" pattern="[a-z\s]+$" value="" size="60" maxlength="" />
<br>
<br>
Sexo:
<input name="Masculino" type="radio" value="" />Masculino <input name="Feminino" type="radio" value="" />Feminino
<br>
<br>
Idade:
<input name="Idade" type="text" size="2" maxlength="2" required="required" pattern="[0-9]+$" />
<br>
<br>
Telefone: <input name="Telefone" type="tel" size="20" maxlength="13" required="required" pattern="\([0-9]{3}\)[0-9]{4,6}-[0-9]{3,4}$" placeholder="(XX)XXXX-XXXX"/>
<br>
<br>
Endereço: <input name="Endereço" type="text" size="60" maxlength="" required="required" pattern="[a-z\s]+$"/>
<br>
<br>
E-mail: <input name="email" type="email" size="40" required="required" class="input-text" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" />
<br>
<br>
Conte-nos um pouco das suas experiências:<br>
<textarea name="experiencia" cols="55" rows="10" required="required"></textarea>
<br><br>
Anexar Curríulo: <input name="arquivo" type="file" size="" required="required" pattern=".pdf" />
<p>
<input type="Submit" value="Enviar ">
<input type="Reset" value="Limpar Dados">
</form>
</div>
<div id="direita">
<h4>Representante Autorizado</h4>
<br>
<img src="imagens/eciriexabus.png">
<br>
<br>
<img src="imagens/seyco.png">
<br>
<h4>Integrador</h4>
<img src="imagens/weg.png">
</div>
</div><!--final div conteudo-->
<div id="rodape" ><!--inicio div rodape-->
<br>
<br>
<br>
<br>
<br>
Todos os direitos reservados a ®Tecmaut Comércio, Indústria e Serviços Eletromecânicos Ltda Me
</div><!--final div rodape-->
</div><!--fim div total-->
</body>
</html>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<?php
header('Content-Type: text/html; charset=UTF-8');
echo '<html>';
$emailpadrao = "rh@tecmaut.com , titecmaut@tecmaut.com";
//Solicita as variáveis para o envio de email
$recipient = $emailpadrao;
//Pega os dados postados pelo formulário HTML e os coloca em variaveis
if (eregi('tempsite.ws$|tecmaut.com$|hospedagemdesites.ws$|websiteseguro.com$', $_SERVER[HTTP_HOST])) {
//substitua na linha acima a aprte locaweb.com.br por seu domínio.
$email_from='titecmaut@tecmaut.com'; // Substitua essa linha pelo seu e-mail@seudominio
}else {
$email_from = "titecmau@teitecmaut.com" . $_SERVER[HTTP_HOST];
// Na linha acima estamos forçando que o remetente seja 'webmaster@',
// você pode alterar para que o remetente seja, por exemplo, 'contato@'.
}
if( PATH_SEPARATOR ==';'){ $quebra_linha="\r\n";
} elseif (PATH_SEPARATOR==':'){ $quebra_linha="\n";
} elseif ( PATH_SEPARATOR!=';' and PATH_SEPARATOR!=':' ) {echo ('Esse script não funcionará corretamente neste servidor, a função PATH_SEPARATOR não retornou o parâmetro esperado.');
}
//pego os dados enviados pelo formulário
$Nome = $_POST["nome"];
$sexo = $_POST["sexo"];
$Idade = $_POST["idade"];
$Telefone = $_POST["telefone"];
$email = $_POST["email"];
$Endereço = $_POST["Endereço"];
$experiencia = $_POST["experiencia"];
//formato o campo da mensagem
$mensagem = wordwrap( $mensagem, 50, "<br>", 1);
//valido os emails
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email)){
echo"<center>Digite um email valido</center>";
echo "<center><a href=\"javascript:history.go(-1)\">Voltar</center></a>";
exit;
}
$arquivo = isset($_FILES["arquivo"]) ? $_FILES["arquivo"] : FALSE;
if(file_exists($arquivo["tmp_name"]) and !empty($arquivo)){
$fp = fopen($_FILES["arquivo"]["tmp_name"],"rb");
$anexo = fread($fp,filesize($_FILES["arquivo"]["tmp_name"]));
$anexo = base64_encode($anexo);
fclose($fp);
$anexo = chunk_split($anexo);
$boundary = "XYZ-" . date("dmYis") . "-ZYX";
$mens = "--$boundary" . $quebra_linha . "";
$mens .= "Content-Transfer-Encoding: 8bits" . $quebra_linha . "";
$mens .= "Content-Type: text/html; charset=\"ISO-8859-1\"" . $quebra_linha . "" . $quebra_linha . ""; //plain
$mens .= "$mensagem" . $quebra_linha . "";
$mens .= "--$boundary" . $quebra_linha . "";
$mens .= "Content-Type: ".$arquivo["type"]."" . $quebra_linha . "";
$mens .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"" . $quebra_linha . "";
$mens .= "Content-Transfer-Encoding: base64" . $quebra_linha . "" . $quebra_linha . "";
$mens .= "$anexo" . $quebra_linha . "";
$mens .= "--$boundary--" . $quebra_linha . "";
$headers = "MIME-Version: 1.0" . $quebra_linha . "";
$headers .= "From: $email_from " . $quebra_linha . "";
$headers .= "Return-Path: $email_from " . $quebra_linha . "";
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"" . $quebra_linha . "";
$headers .= "$boundary" . $quebra_linha . "";
//envio o email com o anexo
mail($email,$assunto,$mens,$headers, "-r".$email_from);
echo"Email enviado com Sucesso!";
}
//se não tiver anexo
else{
$headers = "MIME-Version: 1.0" . $quebra_linha . "";
$headers .= "Content-type: text/html; charset=iso-8859-1" . $quebra_linha . "";
$headers .= "From: $email_from " . $quebra_linha . "";
$headers .= "Return-Path: $email_from " . $quebra_linha . "";
//envia o email sem anexo
mail($email,$assunto,$mensagem, $headers, "-r".$email_from);
echo"Email enviado com Sucesso!";
}
?>