Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //recuperando dados do formul�rio
- $empresa = strip_tags(trim($_POST['empresa']));
- $nome = strip_tags(trim($_POST['nome']));
- $telefone = strip_tags(trim($_POST['telefone']));
- $email = strip_tags(trim($_POST['email']));
- $estado = strip_tags(trim($_POST['estado']));
- $mensagem = strip_tags(trim($_POST['mensagem']));
- $arquivo = $_FILES['arquivo'];
- header('Content-Type: text/html; charset=UTF-8');
- $tamanho = 2097152;
- $tipos = array('image/jpeg', 'image/pjpeg');
- if(empty($empresa)){
- $msg = �O Nome � Obrigat�rio�;
- }elseif(empty($nome)){
- $msg = �O T�tulo � Obrigat�rio�;
- }elseif(empty($telefone)){
- $msg = �O T�tulo � Obrigat�rio�;
- }elseif(!filter_var($email, FILTER_VALIDATE_EMAIL)){
- $msg = �Digite um E-mail v�lido�;
- }elseif(empty($estado)){
- $msg = �O T�tulo � Obrigat�rio�;
- }elseif(empty($mensagem)){
- $msg = �A Mensagem � Obrigat�ria�;
- }elseif($arquivo['size'] > $tamanho){
- $msg = �O limite do tamanho do arquivo � de 2MB�;
- }elseif(!in_array($arquivo['type'], $tipos)){
- $msg = �O tipo do arquivo permitido � apenas JPEG�;
- }else{
- require('PHPMailer/class.phpmailer.php');
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->Port = 25;
- $mail->Host = 'meuhost.com.br';
- $mail->Username = 'usuario';
- $mail->Password = 'senha';
- $mail->Subject = 'Formul�rio de Contato';
- $body = "<strong>Empresa : </strong>{$empresa} <br />
- <strong>Nome : </strong>{$nome} <br />
- <strong>Telefone : </strong>{$telefone} <br />
- <strong>E-mail : </strong>{$email} <br />
- <strong>Estado : </strong>{$estado} <br />
- <br>{$mensagem}";
- //<strong>Arquivo : </strong> ".$arquivo['name'];
- $mail->MsgHTML($body);
- $mail->AddAttachment($arquivo['tmp_name'], $arquivo['name']);
- if($mail->Send())
- echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=http://www.fidelity.com.br/form fidelity/obrigado.html'>";
- else
- echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=http://www.fidelity.com.br/intranet'>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment