Ir para conteúdo

Pesquisar na Comunidade

Mostrando resultados para as tags ''phpmailer''.

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Todas as áreas do Fórum

  • Q&A Desenvolvimento
    • Perguntas e respostas rápidas
  • Desenvolvimento Web
    • Desenvolvimento frontend
    • Javascript
    • PHP
    • Ruby
    • Python
    • Java
    • .NET
    • Docker, Kubernets e outros ambientes
    • Desenvolvimento com Wordpress
    • Desenvolvimento de apps
    • Desenvolvimento ágil
    • Desenvolvimento de Games
    • Banco de Dados
    • Design e UX
    • Algoritmos & Outras Tecnologias
  • Entretenimento e uso pessoal
    • Segurança & Malwares
    • Geral
    • Boteco iMasters

Encontrar resultados em...

Encontrar resultados que...


Data de Criação

  • Início

    FIM


Data de Atualização

  • Início

    FIM


Filtrar pelo número de...

Data de Registro

  • Início

    FIM


Grupo


Google+


Hangouts


Skype


Twitter


deviantART


Github


Flickr


LinkedIn


Pinterest


Facebook


Site Pessoal


Localização


Interesses

Encontrado 19 registros

  1. fmcmf

    Envio PHPMailer chega sem os dados

    Boa tarde... Tenho um formulário no site e o envio é usando o PHPMailer... o email está chegando no destino.... mas o conteúdo inserido nos campos não chega. Segue o código do formulário em html: <div id="banner"> <img class="fotobanner" src="img/comprar.png" alt=""> </div> <div class="formulario"> <h3 align="center"> PREENCHA OS DADOS ABAIXO PARA CONTRATAR: </h3> <form action=”envia.php” method=”post” id=”contato”> <div class="form-group"> <label for="exampleFormControlInput1">Nome completo:</label> <input type="nome" class="form-control" id="nome" placeholder="Nome" required> </div> <div class="form-group"> <label for="exampleFormControlInput1">CPF:</label> <input type="cpf" class="form-control" id="cpfcli" placeholder="CPF" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Gênero:</label> <select class="form-control" id="generocli" required> <option>Feminino</option> <option>Masculino</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">Data de Nascimento (dia/mês/ano):</label> <input type="" class="form-control" id="nasccli" placeholder="Data de nascimento (dia/mês/ano)" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Estado Civil:</label> <select class="form-control" id="ecivilcli" required> <option>Casado(a)</option> <option>Solteiro(a)</option> <option>Divorciado(a)</option> <option>Viúvo(a)</option> </select> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Endereço Completo + CEP:</label> <textarea class="form-control" id="endcli" rows="3" required></textarea> </div> <div class="form-group"> <label for="exampleFormControlInput1">Celular com DDD:</label> <input type="" class="form-control" id="celcli" placeholder="Celular com DDD" required> </div> <div class="form-group"> <label for="exampleFormControlInput1">E-mail:</label> <input type="" class="form-control" id="emailcli" placeholder="E-mail" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">PLANO Desejado:</label> <select class="form-control" id="plano" required> <option>SELECT</option> <option>PLUS</option> <option>TOP</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">NOME do PET:</label> <input type="" class="form-control" id="nomedopet" placeholder="NOME do PET" required> </div> <div class="form-group"> <label for="exampleFormControlInput1">IDADE do PET:</label> <input type="" class="form-control" id="idadedopet" placeholder="IDADE do PET" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Tipo do PET:</label> <select class="form-control" id="tipodopet" required> <option>GATO</option> <option>CACHORRO</option> </select> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Gênero do PET:</label> <select class="form-control" id="generodopet" required> <option>FÊMEA</option> <option>MACHO</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">RAÇA do PET:</label> <input type="" class="form-control" id="racadopet" placeholder="RAÇA do PET" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">PORTE do PET:</label> <select class="form-control" id="portedopet" required> <option>Pequeno</option> <option>Médio</option> <option>Grande</option> </select> </div> <div class="dobotao"> <button type="submit" class="botao"> <strong>ENVIAR DADOS </strong> </button></div> </form></div> Segue o código do enviar.php <?php require 'PHPMailerAutoload.php'; require 'class.phpmailer.php'; $mailer = new PHPMailer; //$mailer->SMTPDebug = 2; // Enable verbose debug output $mailer->isSMTP(); // Set mailer to use SMTP $mailer->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); if($_GET['acao'] = 'enviar'){ $nome = $_POST['nome']; $cpfcli = $_POST['cpfcli']; $generocli = $_POST['generocli']; $nasccli = $_POST['nasccli']; $ecivilcli = $_POST['ecivilcli']; $celcli = $_POST['celcli']; $plano = $_POST['plano']; $nomedopet = $_POST['nomedopet']; $tipodopet = $_POST['tipodopet']; $generodopet = $_POST['generodopet']; $racadopet = $_POST['racadopet']; $portedopet = $_POST['portedopet']; $mailer->Host = 'pleskl0040.hospedagemdesites.ws'; $mailer->SMTPAuth = true; // Enable SMTP authentication $mailer->IsSMTP(); $mailer->isHTML(true); // Set email format to HTML $mailer->Port = 587; // Ativar condição utf-8, para acentuação $mailer->CharSet = 'UTF-8'; $mailer->Username = 'formulario@thna.com.br'; // SMTP username $mailer->Password = '@Nathi1010'; // SMTP password // email do destinatario $address = "formulario@thna.com.br"; //$mailer->SMTPDebug = 1; $corpoMSG = "nome: $nome <br> cpf: $cpfcli <br> genero: $generocli <br> nascimento: $nasccli <br> estado: $ecivilcli <br> celular: $cel <br> plano: $plano <br> pet: $nomedopet <br> tipo: $tipodopet generopet $generodopet <br> racapet: $racadopet <br> porte: $portedopet"; $mailer->AddAddress($address, "destinatario"); $mailer->AddAddress("formulario@thna.com.br", "destinatario 2"); // 2º destinatário se querer enviar, se não, comente com // $mailer->From = 'formulario@thna.com.br'; $mailer->Sender = 'formulario@thna.com.br'; $mailer->FromName = "Site Saúde PET"; // Seu nome // assunto da mensagem $mailer->Subject = $assunto; // corpo da mensagem $mailer->MsgHTML($corpoMSG); if(!$mailer->Send()) { echo "Erro: " . $mailer->ErrorInfo; } else { echo "Mensagem enviada com sucesso!"; } } header('Location: /pet/confirmado.html');  ?> Como comentei, o email chega... mas o conteúdo do form não chega... Segue anexo print da caixa do e-mail: Desde já agradeço.
  2. Boa tarde... Tenho um formulário no site e o envio é usando o PHPMailer... o email está chegando no destino.... mas o conteúdo inserido nos campos não chega. Segue o código do formulário em html: <div id="banner"> <img class="fotobanner" src="img/comprar.png" alt=""> </div> <div class="formulario"> <h3 align="center"> PREENCHA OS DADOS ABAIXO PARA CONTRATAR: </h3> <form action=”envia.php” method=”post” id=”contato”> <div class="form-group"> <label for="exampleFormControlInput1">Nome completo:</label> <input type="nome" class="form-control" id="nome" placeholder="Nome" required> </div> <div class="form-group"> <label for="exampleFormControlInput1">CPF:</label> <input type="cpf" class="form-control" id="cpfcli" placeholder="CPF" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Gênero:</label> <select class="form-control" id="generocli" required> <option>Feminino</option> <option>Masculino</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">Data de Nascimento (dia/mês/ano):</label> <input type="" class="form-control" id="nasccli" placeholder="Data de nascimento (dia/mês/ano)" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Estado Civil:</label> <select class="form-control" id="ecivilcli" required> <option>Casado(a)</option> <option>Solteiro(a)</option> <option>Divorciado(a)</option> <option>Viúvo(a)</option> </select> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Endereço Completo + CEP:</label> <textarea class="form-control" id="endcli" rows="3" required></textarea> </div> <div class="form-group"> <label for="exampleFormControlInput1">Celular com DDD:</label> <input type="" class="form-control" id="celcli" placeholder="Celular com DDD" required> </div> <div class="form-group"> <label for="exampleFormControlInput1">E-mail:</label> <input type="" class="form-control" id="emailcli" placeholder="E-mail" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">PLANO Desejado:</label> <select class="form-control" id="plano" required> <option>SELECT</option> <option>PLUS</option> <option>TOP</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">NOME do PET:</label> <input type="" class="form-control" id="nomedopet" placeholder="NOME do PET" required> </div> <div class="form-group"> <label for="exampleFormControlInput1">IDADE do PET:</label> <input type="" class="form-control" id="idadedopet" placeholder="IDADE do PET" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Tipo do PET:</label> <select class="form-control" id="tipodopet" required> <option>GATO</option> <option>CACHORRO</option> </select> </div> <div class="form-group"> <label for="exampleFormControlSelect1">Gênero do PET:</label> <select class="form-control" id="generodopet" required> <option>FÊMEA</option> <option>MACHO</option> </select> </div> <div class="form-group"> <label for="exampleFormControlInput1">RAÇA do PET:</label> <input type="" class="form-control" id="racadopet" placeholder="RAÇA do PET" required> </div> <div class="form-group"> <label for="exampleFormControlSelect1">PORTE do PET:</label> <select class="form-control" id="portedopet" required> <option>Pequeno</option> <option>Médio</option> <option>Grande</option> </select> </div> <div class="dobotao"> <button type="submit" class="botao"> <strong>ENVIAR DADOS </strong> </button></div> </form></div> Segue o código do enviar.php <?php require 'PHPMailerAutoload.php'; require 'class.phpmailer.php'; $mailer = new PHPMailer; //$mailer->SMTPDebug = 2; // Enable verbose debug output $mailer->isSMTP(); // Set mailer to use SMTP $mailer->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); if($_GET['acao'] = 'enviar'){ $nome = $_POST['nome']; $cpfcli = $_POST['cpfcli']; $generocli = $_POST['generocli']; $nasccli = $_POST['nasccli']; $ecivilcli = $_POST['ecivilcli']; $celcli = $_POST['celcli']; $plano = $_POST['plano']; $nomedopet = $_POST['nomedopet']; $tipodopet = $_POST['tipodopet']; $generodopet = $_POST['generodopet']; $racadopet = $_POST['racadopet']; $portedopet = $_POST['portedopet']; $mailer->Host = 'pleskl0040.hospedagemdesites.ws'; $mailer->SMTPAuth = true; // Enable SMTP authentication $mailer->IsSMTP(); $mailer->isHTML(true); // Set email format to HTML $mailer->Port = 587; // Ativar condição utf-8, para acentuação $mailer->CharSet = 'UTF-8'; $mailer->Username = 'formulario@thna.com.br'; // SMTP username $mailer->Password = '@Nathi1010'; // SMTP password // email do destinatario $address = "formulario@thna.com.br"; //$mailer->SMTPDebug = 1; $corpoMSG = "nome: $nome <br> cpf: $cpfcli <br> genero: $generocli <br> nascimento: $nasccli <br> estado: $ecivilcli <br> celular: $cel <br> plano: $plano <br> pet: $nomedopet <br> tipo: $tipodopet generopet $generodopet <br> racapet: $racadopet <br> porte: $portedopet"; $mailer->AddAddress($address, "destinatario"); $mailer->AddAddress("formulario@thna.com.br", "destinatario 2"); // 2º destinatário se querer enviar, se não, comente com // $mailer->From = 'formulario@thna.com.br'; $mailer->Sender = 'formulario@thna.com.br'; $mailer->FromName = "Site Saúde PET"; // Seu nome // assunto da mensagem $mailer->Subject = $assunto; // corpo da mensagem $mailer->MsgHTML($corpoMSG); if(!$mailer->Send()) { echo "Erro: " . $mailer->ErrorInfo; } else { echo "Mensagem enviada com sucesso!"; } } header('Location: /pet/confirmado.html'); ?> Como comentei, o email chega... mas o conteúdo do form não chega... Segue anexo print da caixa do e-mail: Desde já agradeço.
  3. DinhoPHP

    Problemas ao enviar anexo com PHPMailer

    Estou tentando enviar um anexo e o mesmo não chega no email, apenas quando não faço uso da função attach. arquivo que contém as functions responsáveis pelo envio do email. public function attach(string $filePath, string $fileName): Email{ $this->data->attach[$filePath] = $fileName; return $this; } Arquivo que utiliza a função attach. No arquivo que captura os dados do formulário, já passei os parâmetros de tudo quanto é jeito. require __DIR__ . "/include/head.php"; require __DIR__ . "/vendor/autoload.php"; use Source\Support\Email; $email = new Email(); // CAPTURANDO DADOS DO FORMULÁRIO $nome = trim(ucwords(preg_replace('/\s\s+/', ' ',($_POST['nome-curriculo'])))); $eemail = trim(strtolower(preg_replace('/\s\s+/', ' ',($_POST['email-curriculo'])))); $telefone = trim(preg_replace('/\s\s+/', ' ',($_POST['telefone-curriculo']))); $cidade = trim(preg_replace('/\s\s+/', ' ',($_POST['cidade-curriculo']))); $assunto = trim(preg_replace('/\s\s+/', ' ',($_POST['assunto-curriculo']))); $mensagem = trim(preg_replace('/\s\s+/', ' ',("<pre>".$_POST['mensagem-curriculo']."</pre>"))); // $file_tmp = ($_FILES['file'], $_POST['name']); $files = $_FILES['curriculo']; $email->add($assunto, "<h3>Nome: {$nome}<br>{$files['name']}<br>Email: {$eemail}<br><br>Telefone: {$telefone}<br><br>Cidade: {$cidade}<br><br></br>Mensagem:<br>{$mensagem}</h3>", $nome, $eemail)->attach($files['tmp_name'], $files['name'])->send(); var_dump($files); A função attach que recebe dois parâmetros, quando utilizada, não envia o anexo vindo do form HTML, já digitando os parâmetros na função, ela envia o anexo. Já li até alguns casos semelhantes aqui mesmo e nada! Só envia o anexo digitando os parâmetros manualmente.
  4. BielBagda

    Erro PHPMailer

    Boa tarde, estou tentando fazer com que uma planilha seja enviada via email com php mailer porém está informando 500 Internal Server Error ao clicar em enviar código
  5. Chirlison

    E-mail autenticado com phpmailer

    Olá a todos! Estou utilizando a biblioteca phpmailer para enviar emails autenticados através do formulário de contato do meu site. O problema é que o remetente da mensagem aparece sendo meu próprio email. Eu gostaria de saber se é possível alguém enviar um email preenchido pelo formulário de contato no site e chegasse na minha caixa de e-mail como remetente o email do usuário que preencheu o formulário de contato no site e não o email de autenticação? Desde já, agradeço a todos que puderem ajudar!
  6. analuciagpontes

    Phpmailer no Hostgator

    Galera... Tenho uma hospedagem no Hostgator e quero fazer um phpmailer.... Só que não dá pra fazer com 2 arquivos (um em html e outro em php). Como faço para chamar a função no form action? Envio abaixo o código que está sendo usado. <html><head><title>Formulario Fale conosco</title><style>body { padding: 50px 100px; font-size: 13px; font-family: arial, Tahoma, sans-serif; } a { color:#000; } h2 { margin-bottom: 20px; color: #133141; }input, textarea { padding: 10px; border: 1px solid #E5E5E5; width: 200px; color: #999999; box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px; -moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px; -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px; }textarea { width: 400px; height: 150px; max-width: 400px; line-height: 18px; }input:hover, textarea:hover, input:focus, textarea:focus { border-color: 1px solid #C9C9C9; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px; -moz-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px; -webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 8px; }.form label { margin-bottom: 10px; color: #999999; display: block; }.submit input { width: 100px; height: 40px; background-color: #133141; color: #FFF; border-radius: 3px; moz-border-radius: 3px; -webkit-border-radius: 3px; }</style></head><body><?phpif (isset($_POST['BTEnvia'])){ $function conec (mysql_connect ("XXX.hostgator.com.br","XXX", "XXX", "XXX"));{ $nome = $_POST['nome']; $email = $_POST['email']; $telefone = $_POST['telefone']; $mensagem = $_POST['mensagem']; $email_remetente = "XXX"; $email_destinatario = "XXX"; $email_reply = "$email"; $email_assunto = "Contato formmail"; $email_conteudo = "Nome = $nome \n"; $email_conteudo .= "Email = $email \n"; $email_conteudo .= "Telefone = $telefone \n"; $email_conteudo .= "Mensagem = $mensagem \n"; $email_headers = implode ( "\n",array ( "From: $email_remetente", "Reply-To: $email_reply", "Return-Path: $email_remetente","MIME-Version: 1.0","X-Priority: 3","Content-Type: text/html; charset=UTF-8" ) ); }if (mail ($email_destinatario, $email_assunto, nl2br($email_conteudo), $email_headers)){ echo "E-Mail enviado com sucesso!"; }else{ echo "Falha no envio do E-Mail!"; }}?> <form method="POST" action="conec()"> <p> Nome:<br /> <input type="text" size="30" name="nome"> </p> <p> E-mail:<br /> <input type="text" size="30" name="email"> </p> <p> Telefone:<br /> <input type="text" size="35" name="telefone"> </p> <p> Mensagem:<br /> <input type="text" size="35" name="mensagem"> </p> <p> <input type="submit" name="BTEnvia" value="Enviar"> <input type="reset" name="BTApaga" value="Apagar"> </p></form></body></html>
  7. leandromaehler

    Gerador de formulário de contato com phpmailher

    FormGenerator Fala galera. Criei esse gerador de formulário de contato. Obs.: totalmente livre de créditos do desenvolvedor. (FreeSource) Ele tem mascara de telefone que serve para telefone e celular. Campos obrigatórios. E validação de e-mail. Eu fiz isso para o meu pai. Pois ele nunca consegue configurar o arquivo enviar do phpmailer. Ficou bem fácil de usar. Na primeira página coloque a quantidade de campos você deseja no formulário. Ex.: nome, e-mail, telefone, assunto, mensagem. (5 campos). No segundo formulário. Escreva o nome do campo. Ex.: nome: e-mail tipo: e-mail obrigatório checado. No terceiro formulário você adiciona o Nome que aparecerá junto ao e-mail na mensagem. Ex.: Leandro <leandro@maehler.com.br> Assunto irá aparecer no assunto do e-mail. A senha não é obritatória no site Mas é obrigatória no arquivo enviar.php Caso tenham alguma dúvida ou erros. Favor postar. Obs.: eu ainda não fiz a validação dos campos obrigatórios. Mas o primeiro e terceiro formulários. Todos os campos são obrigatórios. Quem usa gmail hotmail Usar a porta que indica na configuração do mesmo. A página contato.php não tem css. Adicionar as tags dentro do head E no fim da página Como específicado no arquivo. E utilizar as classes. Se a api bombar, eu crio ele estilo página completa e/ou implementação em url. Ex.: seusite.com.br/contato.html Adicione o link e ele gera a página emcima da sua página já criada. Bom proveito
  8. juniormatrix

    PHPMailer com outro servidor

    Boa noite Gostaria de saber se posso hospedar meu site em um determinado servidor, mas usar o serviço de envio de mensagens pelo PHPMailer usando outro servidor diferente, ou seja, o arquivo PHP está num servidor, mas para realizar o envio, usa outro, é possivel?
  9. Fábio Corrêa

    Problemas com classe phpmailer

    Olá pessoal, boa tarde! Estou enfrentando um problema com meu formulário de e-mail que não consigo resolver de forma alguma, já revirei a net e nada. Seguinte, esse formulário que estou tendo problemas estava funcionando perfeitamente até ano passado (2017), e do nada ele para de funcionar. Já tentei de tudo, já atualizei a classe, já utilizei outros formulários prontos e todos estão dando o mesmo erro, tanto localmente (wamp), quanto no servidor de hospedagem. O erro que apresenta é referente ao servidor smtp, parece que ele não está conseguindo fazer autenticação. Vou postar meu código todo e explicar de forma mais detalhada. <?php $nome = utf8_decode (strip_tags(trim($_POST['nomeremetente']))); $email = utf8_decode (strip_tags(trim($_POST['emailremetente']))); $ddd = utf8_decode (strip_tags(trim($_POST['ddd']))); $telefone = utf8_decode (strip_tags(trim($_POST['telefone']))); $assunto = utf8_decode (strip_tags(trim($_POST['assunto']))); $mensagem = utf8_decode (strip_tags(trim($_POST['mensagem']))); require_once('PHPMailer/class.phpmailer.php'); $Email = new PHPMailer(); $Email->SetLanguage("br"); $Email->IsSMTP(); // Habilita o SMTP $Email->SMTPAuth = true; //Ativa e-mail autenticado $Email->Host = 'ssl://smtp.gmail.com'; // Servidor de envio # verificar qual o host correto com a hospedagem as vezes fica como smtp. $mail->SMTPSecure = 'ssl'; // SSL REQUERIDO pelo GMail $Email->Port = '465'; // Porta de envio $Email->Username = 'emaildogmail@gmail.com'; //e-mail que será autenticado $Email->Password = 'minha senha'; // senha do email // ativa o envio de e-mails em HTML, se false, desativa. $Email->IsHTML(true); // email do remetente da mensagem $Email->From = 'emaildoremetente@email.com'; // nome do remetente do email $Email->FromName = utf8_decode($email); // Endereço de destino do emaail, ou seja, pra onde você quer que a mensagem do formulário vá? $Email->AddReplyTo($email, $nome); $Email->AddAddress("emaildestinatario@email.com"); // para quem será enviada a mensagem // informando no email, o assunto da mensagem $Email->Subject = "(Contato do site )"; // Define o texto da mensagem (aceita HTML) $Email->Body .= "<br /><br /> <strong>Nome:</strong> $nome<br /><br /> <strong>E-mail:</strong> $email<br /><br /> <strong>Telefone:</strong> $ddd - $telefone<br /><br /> <strong>Assunto:</strong> $assunto<br /><br /> <strong>Mensagem:</strong><br /> $mensagem"; // verifica se está tudo ok com oa parametros acima, se nao, avisa do erro. Se sim, envia. if(!$Email->Send()){ echo "<script>alert('Ocorreu um erro, tente novamente!');window.history.go(-1)</script>"; echo "Erro: " . $Email->ErrorInfo; }else{ echo "<script>alert('Sua mensagem foi enviada com sucesso!');window.history.go(-1)</script>"; } ?> <div class="div-form"> <h1>Formulário de Contato</h1> <form action="envia.php" method="post"> <fieldset> <p><label for="nome">Nome:</label></p> <input type="text" name="nomeremetente" size="30" class="width233" required="yes"> <p><label for="email">E-mail:</label></p> <input type="text" name="emailremetente" size="30" class="width233" required="yes" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" / > <p><label for="email">Telefone:</label></p> <input type="text" name="ddd" size="10" class="width10" pattern="[0-9]+$" /> <input type="text" name="telefone" size="30" class="tel" pattern="[0-9]+$" /> <p><label for="assunto">Assunto:</label></p> <input type="text" name="assunto" size="30" required="yes" class="width233"/> <p><label for="texto">Mensagem:</label></p> <textarea name="mensagem" rows="10" class="width233" required="yes"></textarea> <input type="submit" name="enviar" value="Enviar" class="enviar" /> </fieldset> </form> </div> Localmente, com wamp exibe esse erro aqui: A linha 17 do arquivo envia.php é essa aqui: $mail->SMTPSecure = 'ssl'; // SSL REQUERIDO pelo GMail E no servidor online ele só exibe a mensagem de erro: Erro de SMTP: Não foi possivel conectar com o servidor SMTP. o que eu já fiz: Alterei a porta para 587. Retirei o SSL:// do > $Email->Host = 'ssl://smtp.gmail.com'; Já procurei formulários prontos, porém todos exibem o mesmo erro de SMTP. Já tentei com outra conta do gmail. E lembrando que sempre esteve ativado a opção de DISPOSITIVOS MENOS SEGUROS, no google para que ele não bloqueie o envio. O que eu achei estranho foi que, ontem tentando consertar esse erro, por acaso acessei o email do gmail que estou utilizando e recebi um alerta. Só não entendi porque o gmail está bloqueando, sendo que eu já ativei o acesso a aplicativos menos seguros. Estranho que quando eu alterei para uma outra conta do gmail para fazer um teste eu nem se quer recebi essas notificações do gmail. Será existe alguma configuração além dessa que possa estar bloqueando???? Creio que meu código esteja funcionando perfeitamente, pois como disse ele estava funcionando e do nada parou. Alguém já passou por isso? Podem me ajudar? Desde já eu agradeço aos amigos que disponibilizarão de seu tempo para tentar me ajudar. Abraço.
  10. Pessoal estou usando PHPMailer para enviar email com dados do formulário e ao mesmo tempo gravar no mysql. O email esta sendo enviado mas não esta gravando no banco, não sei onde estou errando segue meu código. <?php include 'header.php'; ?> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="row"> <?php date_default_timezone_set('Etc/UTC'); if(isset($_POST['btnsave'])) { $id_cliente = $_POST['id_cliente']; $produto = $_POST['produto']; $medida = $_POST['medida']; $msg = $_POST['msg']; $qtd = $_POST['qtd']; $aprovado = $_POST['aprovado']; $status = $_POST['status']; $data_orca = date('Y-m-d'); $imgFile = $_FILES['user_image']['name']; $tmp_dir = $_FILES['user_image']['tmp_name']; $imgSize = $_FILES['user_image']['size']; if(empty($imgFile)){ $errMSG = "Please Select Image File."; } else { $upload_dir = 'imagens/orcamento/'; // upload directory $imgExt = strtolower(pathinfo($imgFile,PATHINFO_EXTENSION)); // get image extension // valid image extensions $valid_extensions = array('jpeg', 'jpg', 'png', 'gif'); // valid extensions // rename uploading image $userpic = rand(1000,1000000).".".$imgExt; // allow valid image file formats if(in_array($imgExt, $valid_extensions)){ // Check file size '5MB' if($imgSize < 5000000) { move_uploaded_file($tmp_dir,$upload_dir.$userpic); } else{ $errMSG = "Desculpe seu arquivo é muito grande."; } } else{ $errMSG = "Desculpe, somente arquivos JPG, JPEG, PNG e GIF são aceitos."; } } require_once('includes/init.php'); if(!isset($errMSG)){ $addv=$pdo->prepare("INSERT INTO orcamento (id_cliente, produto, medida, qtd, msg, aprovado, status, data_orca, img) VALUE(?,?,?,?,?,?,?,?,?)"); $addv->bindValue("1",$id_cliente); $addv->bindValue("2",$produto); $addv->bindValue("3",$medida); $addv->bindValue("4",$qtd); $addv->bindValue("5",$msg); $addv->bindValue("6",$aprovado); $addv->bindValue("7",$status); $addv->bindValue("8",$data_orca); $addv->bindValue("9",$userpic); if($addv->execute()) { $successMSG = "Orçamento enviado com sucesso..."; } else { $errMSG = "Erro ao enviado Orçamento..."; } } $path_file = $upload_dir.$userpic; /////////////////////////////////////////////////////////////////////////////////////////////// require 'phpmailer/PHPMailerAutoload.php'; //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); $mail->CharSet = 'UTF-8'; //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 0; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = "smtp.uhserver.com"; //Set the SMTP port number - likely to be 25, 465 or 587 $mail->Port = 587; //Whether to use SMTP authentication $mail->SMTPAuth = true; //Username to use for SMTP authentication $mail->Username = "contato@xxxxx.com.br"; //Password to use for SMTP authentication $mail->Password = "xxxxxx"; //Set who the message is to be sent from $mail->setFrom('contato@xxxxx.com.br', 'xxxxx'); //Set an alternative reply-to address $mail->addReplyTo('no-reply@xxxxx.com.br', 'xxxxx'); //Set who the message is to be sent to $mail->addAddress('contato@xxxxx.com.br', 'xxxxx'); //Mantenha-o simples - não use HTML $mail->isHTML(true); $id = $_SESSION['id_do_produto']; $add_pro = $pdo->prepare("SELECT * FROM produtos WHERE id = '$id' ORDER BY nome_produto ASC"); $add_pro->execute(); while($row=$add_pro->fetch(PDO::FETCH_ASSOC)){ extract($row); $assunto = ''.$row['nome_produto'].''; } //Set the subject line $mail->Subject = 'Solicitação de orcamento de: '.$assunto.''; $mail->Body = ' <html bgcolor="#E6E6E6"> <table able width="60%" align="center" style="background-color:#ffffff; border:1px solid #cccccc;"> <tr style="background-color:#ffffff; border: 1px solid #cccccc;"> <td><a href="http://xxxxx.com.br" target="_blank"><img src="http://xxxxx.com.br/imagens/logo.png" width="300" height="80" /></a></td> </tr> <tr> <td colspan="3"><hr / style="color:#cccccc;"></td> </tr> <tr style="background-color:#ffffff; border: 1px solid #cccccc;"> <td style="color:blue;"><strong> '.$assunto.'</strong></td> </tr> <tr> <td colspan="3"><hr / style="color:#cccccc;"></td> </tr> <tr> <td colspan="2">'.$msg.'</td> </tr> <tr> <td colspan="3"><hr / style="color:#cccccc;"></td> </tr> <tr> <td colspan="3" style="font-size:9px;">Roda pé do formulário</td> </tr> </table> </html> '; //$mail->AddAttachment($path_file); //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body //$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); //Replace the plain text body with one created manually //$mail->AltBody = 'This is a plain-text message body'; //Attach an image file //$mail->addAttachment('examples/images/phpmailer_mini.png'); //send the message, check for errors if (!$mail->send()) { //echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Mensagem Enviada!"; header('Location: index.php'); } } ?> <br/><br/> <table class="table table-bordered table-responsive"> <form method="post" enctype="multipart/form-data" class="form-horizontal"> <tr> <td><label class="control-label">Produto:</label></td> <?php $id = $_SESSION['id_do_produto']; $add_pro = $pdo->prepare("SELECT * FROM produtos WHERE id = '$id' ORDER BY nome_produto ASC"); $add_pro->execute(); while($row=$add_pro->fetch(PDO::FETCH_ASSOC)){ extract($row); echo'<td><input class="form-control" type="text" name="produto" value="'.$row['nome_produto'].'"/></td>'; } ?> </tr> <tr> <td><label class="control-label">Cliente:</label></td> <td><input class="form-control" type="text" name="" value="<?php echo $_SESSION['c_nome'] ?>"/> <input class="form-control" type="hidden" name="id_cliente" value="<?php echo $_SESSION['c_id'] ?>"/></td> </tr> <tr> <td><label class="control-label">Medida: <i style="font-size: 11px">Altura X Largura</i></label></td> <td><input class="form-control" type="text" name="medida" placeholder="0,00 x 0,00" /></td> </tr> <tr> <td><label class="control-label">Quantidde:</label></td> <td><input class="form-control" type="text" name="qtd" /></td> </tr> <tr> <td><label class="control-label">Mensagem.</label></td> <td><textarea class="form-control" type="text" name="msg" rows="3" placeholder="Mensagem"></textarea></td> </tr> <input class="form-control" type="hidden" name="aprovado" value="Não" /> <input class="form-control" type="hidden" name="status" value="Aberto" /> <tr> <td><label class="control-label">Envie seu Layout.</label></td> <td><input class="input-group" type="file" name="user_image" accept="image/*" /></td> </tr> <tr> <td colspan="2" style="text-align:center; padding: 30px;"><button type="submit" name="btnsave" class="btn btn-primary"> <span class="glyphicon glyphicon-save"></span> &nbsp; Enviar Orçamento &nbsp; </button> </td> </tr> </form> </table> </div><!-- /.row --> </div><!-- /.col-md-12 --> </div><!-- /.row --> </div><!-- /.container --> <?php include 'footer.php'; ?>
  11. paulo padua

    PHPMailer com conta hotmail

    Olá pessoal Estou precisando de uma ajuda. Utilizo o PHPMailer com Gmail e tudo ok. Mas preciso configurar ele para um conta Hotmail. Já verifiquei na Internet as configurações mas gera erra no envio. Utilizei o servidor SMTP.live.com e porta 587 e tls e até ssl e não gera o mesmo erro. Alguém poderia me informar como eu resolvo esse problema? 019-10-08 20:18:00 Connection: opening to smtp.live.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),) 2019-10-08 20:18:00 Connection: opened 2019-10-08 20:18:00 SMTP INBOUND: "220 CP2P15201CA0018.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 8 Oct 2019 20:17:58 +0000" 2019-10-08 20:18:00 SERVER -> CLIENT: 220 CP2P15201CA0018.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 8 Oct 2019 20:17:58 +0000 2019-10-08 20:18:00 CLIENT -> SERVER: EHLO localhost 2019-10-08 20:18:00 SMTP INBOUND: "250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]" 2019-10-08 20:18:00 SMTP INBOUND: "250-SIZE 157286400" 2019-10-08 20:18:00 SMTP INBOUND: "250-PIPELINING" 2019-10-08 20:18:00 SMTP INBOUND: "250-DSN" 2019-10-08 20:18:00 SMTP INBOUND: "250-ENHANCEDSTATUSCODES" 2019-10-08 20:18:00 SMTP INBOUND: "250-STARTTLS" 2019-10-08 20:18:00 SMTP INBOUND: "250-8BITMIME" 2019-10-08 20:18:00 SMTP INBOUND: "250 SMTPUTF8" 2019-10-08 20:18:00 SERVER -> CLIENT: 250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250 SMTPUTF8 2019-10-08 20:18:00 CLIENT -> SERVER: STARTTLS 2019-10-08 20:18:00 SMTP INBOUND: "220 2.0.0 SMTP server ready" 2019-10-08 20:18:00 SERVER -> CLIENT: 220 2.0.0 SMTP server ready 2019-10-08 20:18:00 CLIENT -> SERVER: EHLO localhost 2019-10-08 20:18:00 SMTP INBOUND: "250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]" 2019-10-08 20:18:00 SMTP INBOUND: "250-SIZE 157286400" 2019-10-08 20:18:00 SMTP INBOUND: "250-PIPELINING" 2019-10-08 20:18:00 SMTP INBOUND: "250-DSN" 2019-10-08 20:18:00 SMTP INBOUND: "250-ENHANCEDSTATUSCODES" 2019-10-08 20:18:00 SMTP INBOUND: "250-AUTH LOGIN XOAUTH2" 2019-10-08 20:18:00 SMTP INBOUND: "250-8BITMIME" 2019-10-08 20:18:00 SMTP INBOUND: "250 SMTPUTF8" 2019-10-08 20:18:00 SERVER -> CLIENT: 250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250 SMTPUTF8 2019-10-08 20:18:00 Auth method requested: UNSPECIFIED 2019-10-08 20:18:00 Auth methods available on the server: LOGIN,XOAUTH2 2019-10-08 20:18:00 Requested auth method not available: 2019-10-08 20:18:00 Auth method selected: LOGIN 2019-10-08 20:18:00 CLIENT -> SERVER: AUTH LOGIN 2019-10-08 20:18:00 SMTP INBOUND: "334 VXNlcm5hbWU6" 2019-10-08 20:18:00 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2019-10-08 20:18:00 CLIENT -> SERVER: cGF1bG9fZGVfbGFjZXJkYUBob3RtYWlsLmNvbQ== 2019-10-08 20:18:00 SMTP INBOUND: "334 UGFzc3dvcmQ6" 2019-10-08 20:18:00 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2019-10-08 20:18:00 CLIENT -> SERVER: UEB1bG9QYWR1YTI0MDYg 2019-10-08 20:18:03 SMTP INBOUND: "235 2.7.0 Authentication successful" 2019-10-08 20:18:03 SERVER -> CLIENT: 235 2.7.0 Authentication successful 2019-10-08 20:18:03 CLIENT -> SERVER: MAIL FROM:<emailtambem@gmail.com> 2019-10-08 20:18:03 SMTP INBOUND: "250 2.1.0 Sender OK" 2019-10-08 20:18:03 SERVER -> CLIENT: 250 2.1.0 Sender OK 2019-10-08 20:18:03 CLIENT -> SERVER: RCPT TO:<emailtambem@gmail.com> 2019-10-08 20:18:03 SMTP INBOUND: "250 2.1.5 Recipient OK" 2019-10-08 20:18:03 SERVER -> CLIENT: 250 2.1.5 Recipient OK 2019-10-08 20:18:03 CLIENT -> SERVER: DATA 2019-10-08 20:18:03 SMTP INBOUND: "354 Start mail input; end with <CRLF>.<CRLF>" 2019-10-08 20:18:03 SERVER -> CLIENT: 354 Start mail input; end with <CRLF>.<CRLF> 2019-10-08 20:18:03 CLIENT -> SERVER: Date: Tue, 8 Oct 2019 20:18:00 +0000 2019-10-08 20:18:03 CLIENT -> SERVER: To: Nome esta correto <emailtambem@gmail.com> 2019-10-08 20:18:03 CLIENT -> SERVER: From: First Last <emailtambem@gmail.com> 2019-10-08 20:18:03 CLIENT -> SERVER: Reply-To: First Last <replyto@example.com> 2019-10-08 20:18:03 CLIENT -> SERVER: Subject: PHPMailer GMail SMTP test 2019-10-08 20:18:03 CLIENT -> SERVER: Message-ID: <aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ@localhost> 2019-10-08 20:18:03 CLIENT -> SERVER: X-Mailer: PHPMailer 6.1.1 (https://github.com/PHPMailer/PHPMailer) 2019-10-08 20:18:03 CLIENT -> SERVER: MIME-Version: 1.0 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Type: multipart/alternative; 2019-10-08 20:18:03 CLIENT -> SERVER: boundary="b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ" 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: This is a multi-part message in MIME format. 2019-10-08 20:18:03 CLIENT -> SERVER: --b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: This is a plain-text message body 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: --b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: <h1> Teste </h1> 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: --b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ-- 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: . 2019-10-08 20:18:04 SMTP INBOUND: "554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000" 2019-10-08 20:18:04 SERVER -> CLIENT: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000 2019-10-08 20:18:04 SMTP ERROR: DATA END command failed: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000 SMTP Error: data not accepted. Mailer Error: SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000 SMTP code: 554 Additional SMTP info: 5.2.02019-10-08 20:18:04 CLIENT -> SERVER: QUIT 2019-10-08 20:18:04 SMTP INBOUND: "0000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:42000000, 1.36674:32000000, 1.61250:00000000, 1.45378:47000000, 1.44866:01000000, 16.55847:AE000000, 17.43559:0000000000030000000000000000000000000000, 20.52176:140F1789150070200A005C85, 20.50032:140F17898617F01F6B050000, 0.35180:0A000000, 255.23226:4800D13D, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:02000000, 4.21921:DC040000, 255.27962:FA" 2019-10-08 20:18:04 SMTP INBOUND: "000000, 255.1494:00000000, 0.38698:0F010480, 0.37692:01000000, 0.37948:13000100, 5.33852:00000000534D545000000100, 7.36354:010000000000010905000780, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:FDBF0600AF84EF3B000000000000000013000100, 5.10786:0000000031352E32302E323332372E3030343A424C30505231324D42323438343A62366536333132362D623762352D346531622D613639632D34326465393539653533363500101013000100, 7.51330:4AF8789F2C4CD7081300010" 2019-10-08 20:18:04 SMTP INBOUND: "0, 255.1750:AC050000, 255.31418:0A00CF85, 0.22753:0A00F136, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00F636, 4.30158:DC040000 [Hostname=BL0PR12MB2484.namprd12.prod.outlook.com]" 2019-10-08 20:18:04 SMTP INBOUND: "221 2.0.0 Service closing transmission channel" 2019-10-08 20:18:04 SERVER -> CLIENT: 0000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:42000000, 1.36674:32000000, 1.61250:00000000, 1.45378:47000000, 1.44866:01000000, 16.55847:AE000000, 17.43559:0000000000030000000000000000000000000000, 20.52176:140F1789150070200A005C85, 20.50032:140F17898617F01F6B050000, 0.35180:0A000000, 255.23226:4800D13D, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:02000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:00000000, 0.38698:0F010480, 0.37692:01000000, 0.37948:13000100, 5.33852:00000000534D545000000100, 7.36354:010000000000010905000780, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:FDBF0600AF84EF3B000000000000000013000100, 5.10786:0000000031352E32302E323332372E3030343A424C30505231324D42323438343A62366536333132362D623762352D346531622D613639632D34326465393539653533363500101013000100, 7.51330:4AF8789F2C4CD70813000100, 255.1750:AC050000, 255.31418:0A00CF85, 0.22753:0A00F136, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00F636, 4.30158:DC040000 [Hostname=BL0PR12MB2484.namprd12.prod.outlook.com]221 2.0.0 Service closing transmission channel 2019-10-08 20:18:04 SMTP ERROR: QUIT command failed: 0000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:42000000, 1.36674:32000000, 1.61250:00000000, 1.45378:47000000, 1.44866:01000000, 16.55847:AE000000, 17.43559:0000000000030000000000000000000000000000, 20.52176:140F1789150070200A005C85, 20.50032:140F17898617F01F6B050000, 0.35180:0A000000, 255.23226:4800D13D, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:02000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:00000000, 0.38698:0F010480, 0.37692:01000000, 0.37948:13000100, 5.33852:00000000534D545000000100, 7.36354:010000000000010905000780, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:FDBF0600AF84EF3B000000000000000013000100, 5.10786:0000000031352E32302E323332372E3030343A424C30505231324D42323438343A62366536333132362D623762352D346531622D613639632D34326465393539653533363500101013000100, 7.51330:4AF8789F2C4CD70813000100, 255.1750:AC050000, 255.31418:0A00CF85, 0.22753:0A00F136, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00F636, 4.30158:DC040000 [Hostname=BL0PR12MB2484.namprd12.prod.outlook.com]221 2.0.0 Service closing transmission channel 2019-10-08 20:18:04 Connection: closed A configuração do arquivo PHP <?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require './PHPMailer/Exception.php'; require './PHPMailer/PHPMailer.php'; require './PHPMailer/SMTP.php'; /** * This example shows settings to use when sending via Google's Gmail servers. * This uses traditional id & password authentication - look at the gmail_xoauth.phps * example to see how to use XOAUTH2. * The IMAP section shows how to save this message to the 'Sent Mail' folder using IMAP commands. */ //Import PHPMailer classes into the global namespace //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // SMTP::DEBUG_OFF = off (for production use) // SMTP::DEBUG_CLIENT = client messages // SMTP::DEBUG_SERVER = client and server messages $mail->SMTPDebug = 4; //Set the hostname of the mail server $mail->Host = 'smtp.live.com'; // use // $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6 //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = 587; //Set the encryption mechanism to use - STARTTLS or SMTPS $mail->SMTPSecure = 'tsl'; //Whether to use SMTP authentication $mail->SMTPAuth = true; $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); //Username to use for SMTP authentication - use full email address for gmail $mail->Username = " meu email "; meu email do hotmail //Password to use for SMTP authentication $mail->Password = "senha "; //aqui eu coloquei minha senha do hotmail //Set who the message is to be sent from $mail->setFrom('meuemail@gmail.com', 'First Last'); //Set an alternative reply-to address $mail->addReplyTo('replyto@example.com', 'First Last'); //Set who the message is to be sent to $mail->addAddress('meuemail@gmail.com', 'meunome'); //Set the subject line $mail->Subject = 'PHPMailer GMail SMTP test'; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML( "<h1> Teste </h1>"); //Replace the plain text body with one created manually $mail->AltBody = 'This is a plain-text message body'; //Attach an image file //$mail->addAttachment('images/phpmailer_mini.png'); //send the message, check for errors if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; //Section 2: IMAP //Uncomment these to save your message in the 'Sent Mail' folder. #if (save_mail($mail)) { # echo "Message saved!"; #} } ?> Se algum colega puder me dar uma luz eu agradeço. Com Gmail funciona normalmente.
  12. paulo padua

    PHPMailer com conta hotmail

    Olá pessoal Estou precisando de uma ajuda. Utilizo o PHPMailer com Gmail e tudo ok. Mas preciso configurar ele para um conta Hotmail. Já verifiquei na Internet as configurações mas gera erra no envio. Utilizei o servidor SMTP.live.com e porta 587 e tls e até ssl e não gera o mesmo erro. Alguém poderia me informar como eu resolvo esse problema? 019-10-08 20:18:00 Connection: opening to smtp.live.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),) 2019-10-08 20:18:00 Connection: opened 2019-10-08 20:18:00 SMTP INBOUND: "220 CP2P15201CA0018.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 8 Oct 2019 20:17:58 +0000" 2019-10-08 20:18:00 SERVER -> CLIENT: 220 CP2P15201CA0018.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 8 Oct 2019 20:17:58 +0000 2019-10-08 20:18:00 CLIENT -> SERVER: EHLO localhost 2019-10-08 20:18:00 SMTP INBOUND: "250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]" 2019-10-08 20:18:00 SMTP INBOUND: "250-SIZE 157286400" 2019-10-08 20:18:00 SMTP INBOUND: "250-PIPELINING" 2019-10-08 20:18:00 SMTP INBOUND: "250-DSN" 2019-10-08 20:18:00 SMTP INBOUND: "250-ENHANCEDSTATUSCODES" 2019-10-08 20:18:00 SMTP INBOUND: "250-STARTTLS" 2019-10-08 20:18:00 SMTP INBOUND: "250-8BITMIME" 2019-10-08 20:18:00 SMTP INBOUND: "250 SMTPUTF8" 2019-10-08 20:18:00 SERVER -> CLIENT: 250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250 SMTPUTF8 2019-10-08 20:18:00 CLIENT -> SERVER: STARTTLS 2019-10-08 20:18:00 SMTP INBOUND: "220 2.0.0 SMTP server ready" 2019-10-08 20:18:00 SERVER -> CLIENT: 220 2.0.0 SMTP server ready 2019-10-08 20:18:00 CLIENT -> SERVER: EHLO localhost 2019-10-08 20:18:00 SMTP INBOUND: "250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]" 2019-10-08 20:18:00 SMTP INBOUND: "250-SIZE 157286400" 2019-10-08 20:18:00 SMTP INBOUND: "250-PIPELINING" 2019-10-08 20:18:00 SMTP INBOUND: "250-DSN" 2019-10-08 20:18:00 SMTP INBOUND: "250-ENHANCEDSTATUSCODES" 2019-10-08 20:18:00 SMTP INBOUND: "250-AUTH LOGIN XOAUTH2" 2019-10-08 20:18:00 SMTP INBOUND: "250-8BITMIME" 2019-10-08 20:18:00 SMTP INBOUND: "250 SMTPUTF8" 2019-10-08 20:18:00 SERVER -> CLIENT: 250-CP2P15201CA0018.outlook.office365.com Hello [2804:14c:c0:83d8:899e:1d6c:a4ab:f228]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250 SMTPUTF8 2019-10-08 20:18:00 Auth method requested: UNSPECIFIED 2019-10-08 20:18:00 Auth methods available on the server: LOGIN,XOAUTH2 2019-10-08 20:18:00 Requested auth method not available: 2019-10-08 20:18:00 Auth method selected: LOGIN 2019-10-08 20:18:00 CLIENT -> SERVER: AUTH LOGIN 2019-10-08 20:18:00 SMTP INBOUND: "334 VXNlcm5hbWU6" 2019-10-08 20:18:00 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2019-10-08 20:18:00 CLIENT -> SERVER: cGF1bG9fZGVfbGFjZXJkYUBob3RtYWlsLmNvbQ== 2019-10-08 20:18:00 SMTP INBOUND: "334 UGFzc3dvcmQ6" 2019-10-08 20:18:00 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2019-10-08 20:18:00 CLIENT -> SERVER: UEB1bG9QYWR1YTI0MDYg 2019-10-08 20:18:03 SMTP INBOUND: "235 2.7.0 Authentication successful" 2019-10-08 20:18:03 SERVER -> CLIENT: 235 2.7.0 Authentication successful 2019-10-08 20:18:03 CLIENT -> SERVER: MAIL FROM:<emailtambem@gmail.com> 2019-10-08 20:18:03 SMTP INBOUND: "250 2.1.0 Sender OK" 2019-10-08 20:18:03 SERVER -> CLIENT: 250 2.1.0 Sender OK 2019-10-08 20:18:03 CLIENT -> SERVER: RCPT TO:<emailtambem@gmail.com> 2019-10-08 20:18:03 SMTP INBOUND: "250 2.1.5 Recipient OK" 2019-10-08 20:18:03 SERVER -> CLIENT: 250 2.1.5 Recipient OK 2019-10-08 20:18:03 CLIENT -> SERVER: DATA 2019-10-08 20:18:03 SMTP INBOUND: "354 Start mail input; end with <CRLF>.<CRLF>" 2019-10-08 20:18:03 SERVER -> CLIENT: 354 Start mail input; end with <CRLF>.<CRLF> 2019-10-08 20:18:03 CLIENT -> SERVER: Date: Tue, 8 Oct 2019 20:18:00 +0000 2019-10-08 20:18:03 CLIENT -> SERVER: To: Nome esta correto <emailtambem@gmail.com> 2019-10-08 20:18:03 CLIENT -> SERVER: From: First Last <emailtambem@gmail.com> 2019-10-08 20:18:03 CLIENT -> SERVER: Reply-To: First Last <replyto@example.com> 2019-10-08 20:18:03 CLIENT -> SERVER: Subject: PHPMailer GMail SMTP test 2019-10-08 20:18:03 CLIENT -> SERVER: Message-ID: <aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ@localhost> 2019-10-08 20:18:03 CLIENT -> SERVER: X-Mailer: PHPMailer 6.1.1 (https://github.com/PHPMailer/PHPMailer) 2019-10-08 20:18:03 CLIENT -> SERVER: MIME-Version: 1.0 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Type: multipart/alternative; 2019-10-08 20:18:03 CLIENT -> SERVER: boundary="b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ" 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: This is a multi-part message in MIME format. 2019-10-08 20:18:03 CLIENT -> SERVER: --b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: This is a plain-text message body 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: --b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ 2019-10-08 20:18:03 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: <h1> Teste </h1> 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: --b1_aIAlUeaoBd7VG6a2DIVHBqZ6KXzxaPmnUxcn1jlcXYQ-- 2019-10-08 20:18:03 CLIENT -> SERVER: 2019-10-08 20:18:03 CLIENT -> SERVER: . 2019-10-08 20:18:04 SMTP INBOUND: "554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000" 2019-10-08 20:18:04 SERVER -> CLIENT: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000 2019-10-08 20:18:04 SMTP ERROR: DATA END command failed: 554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000 SMTP Error: data not accepted. Mailer Error: SMTP Error: data not accepted.SMTP server error: DATA END command failed Detail: STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. 0.35250:0A00D884, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:49020000, 1.36674:0E000000, 1.61250:00000000, 1.45378:4E020000, 1.44866:2E010000, 16.55847:E2030000, 17.43559:0000000004020000000000000000000000000000, 20.52176:140F17891500001043050000, 20.50032:140F17898617001000000000, 0.35180:0A000000, 255.23226:0000 SMTP code: 554 Additional SMTP info: 5.2.02019-10-08 20:18:04 CLIENT -> SERVER: QUIT 2019-10-08 20:18:04 SMTP INBOUND: "0000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:42000000, 1.36674:32000000, 1.61250:00000000, 1.45378:47000000, 1.44866:01000000, 16.55847:AE000000, 17.43559:0000000000030000000000000000000000000000, 20.52176:140F1789150070200A005C85, 20.50032:140F17898617F01F6B050000, 0.35180:0A000000, 255.23226:4800D13D, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:02000000, 4.21921:DC040000, 255.27962:FA" 2019-10-08 20:18:04 SMTP INBOUND: "000000, 255.1494:00000000, 0.38698:0F010480, 0.37692:01000000, 0.37948:13000100, 5.33852:00000000534D545000000100, 7.36354:010000000000010905000780, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:FDBF0600AF84EF3B000000000000000013000100, 5.10786:0000000031352E32302E323332372E3030343A424C30505231324D42323438343A62366536333132362D623762352D346531622D613639632D34326465393539653533363500101013000100, 7.51330:4AF8789F2C4CD7081300010" 2019-10-08 20:18:04 SMTP INBOUND: "0, 255.1750:AC050000, 255.31418:0A00CF85, 0.22753:0A00F136, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00F636, 4.30158:DC040000 [Hostname=BL0PR12MB2484.namprd12.prod.outlook.com]" 2019-10-08 20:18:04 SMTP INBOUND: "221 2.0.0 Service closing transmission channel" 2019-10-08 20:18:04 SERVER -> CLIENT: 0000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:42000000, 1.36674:32000000, 1.61250:00000000, 1.45378:47000000, 1.44866:01000000, 16.55847:AE000000, 17.43559:0000000000030000000000000000000000000000, 20.52176:140F1789150070200A005C85, 20.50032:140F17898617F01F6B050000, 0.35180:0A000000, 255.23226:4800D13D, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:02000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:00000000, 0.38698:0F010480, 0.37692:01000000, 0.37948:13000100, 5.33852:00000000534D545000000100, 7.36354:010000000000010905000780, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:FDBF0600AF84EF3B000000000000000013000100, 5.10786:0000000031352E32302E323332372E3030343A424C30505231324D42323438343A62366536333132362D623762352D346531622D613639632D34326465393539653533363500101013000100, 7.51330:4AF8789F2C4CD70813000100, 255.1750:AC050000, 255.31418:0A00CF85, 0.22753:0A00F136, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00F636, 4.30158:DC040000 [Hostname=BL0PR12MB2484.namprd12.prod.outlook.com]221 2.0.0 Service closing transmission channel 2019-10-08 20:18:04 SMTP ERROR: QUIT command failed: 0000, 255.27962:0A000000, 255.27962:0E000000, 255.31418:0A000000, 0.35250:00000000, 1.36674:0A000000, 1.61250:00000000, 1.45378:02000000, 1.44866:42000000, 1.36674:32000000, 1.61250:00000000, 1.45378:47000000, 1.44866:01000000, 16.55847:AE000000, 17.43559:0000000000030000000000000000000000000000, 20.52176:140F1789150070200A005C85, 20.50032:140F17898617F01F6B050000, 0.35180:0A000000, 255.23226:4800D13D, 255.27962:0A000000, 255.27962:32000000, 255.17082:DC040000, 0.27745:02000000, 4.21921:DC040000, 255.27962:FA000000, 255.1494:00000000, 0.38698:0F010480, 0.37692:01000000, 0.37948:13000100, 5.33852:00000000534D545000000100, 7.36354:010000000000010905000780, 4.56248:DC040000, 7.40748:010000000000010B05000780, 7.57132:000000000000000000000000, 1.63016:32000000, 4.39640:DC040000, 8.45434:FDBF0600AF84EF3B000000000000000013000100, 5.10786:0000000031352E32302E323332372E3030343A424C30505231324D42323438343A62366536333132362D623762352D346531622D613639632D34326465393539653533363500101013000100, 7.51330:4AF8789F2C4CD70813000100, 255.1750:AC050000, 255.31418:0A00CF85, 0.22753:0A00F136, 255.21817:DC040000, 4.60547:DC040000, 0.21966:0A00F636, 4.30158:DC040000 [Hostname=BL0PR12MB2484.namprd12.prod.outlook.com]221 2.0.0 Service closing transmission channel 2019-10-08 20:18:04 Connection: closed A configuração do arquivo PHP <?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require './PHPMailer/Exception.php'; require './PHPMailer/PHPMailer.php'; require './PHPMailer/SMTP.php'; /** * This example shows settings to use when sending via Google's Gmail servers. * This uses traditional id & password authentication - look at the gmail_xoauth.phps * example to see how to use XOAUTH2. * The IMAP section shows how to save this message to the 'Sent Mail' folder using IMAP commands. */ //Import PHPMailer classes into the global namespace //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // SMTP::DEBUG_OFF = off (for production use) // SMTP::DEBUG_CLIENT = client messages // SMTP::DEBUG_SERVER = client and server messages $mail->SMTPDebug = 4; //Set the hostname of the mail server $mail->Host = 'smtp.live.com'; // use // $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6 //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = 587; //Set the encryption mechanism to use - STARTTLS or SMTPS $mail->SMTPSecure = 'tsl'; //Whether to use SMTP authentication $mail->SMTPAuth = true; $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); //Username to use for SMTP authentication - use full email address for gmail $mail->Username = " meu email "; meu email do hotmail //Password to use for SMTP authentication $mail->Password = "senha "; //aqui eu coloquei minha senha do hotmail //Set who the message is to be sent from $mail->setFrom('meuemail@gmail.com', 'First Last'); //Set an alternative reply-to address $mail->addReplyTo('replyto@example.com', 'First Last'); //Set who the message is to be sent to $mail->addAddress('meuemail@gmail.com', 'meunome'); //Set the subject line $mail->Subject = 'PHPMailer GMail SMTP test'; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML( "<h1> Teste </h1>"); //Replace the plain text body with one created manually $mail->AltBody = 'This is a plain-text message body'; //Attach an image file //$mail->addAttachment('images/phpmailer_mini.png'); //send the message, check for errors if (!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; //Section 2: IMAP //Uncomment these to save your message in the 'Sent Mail' folder. #if (save_mail($mail)) { # echo "Message saved!"; #} } ?> Se algum colega puder me dar uma luz eu agradeço. Com Gmail funciona normalmente.
  13. joaolino

    Recuperar senha, php, pdo, PHPMailer

    Olá pessoal tudo bem? estou precisando de uma ajuda, sou muito novo em php ou qualquer programação, porém acompanhando video aulas e varias informações disponíveis pela internet, consegui criar um aplicativo para celular android. porém na parte de recuperação de senha está acontecendo um erro que não estou conseguindo corrigir. Não consigo puxar os dados do banco de dados e enviar para o e-mail do usuário. O erro que retorna é o seguinte: Warning: Invalid argument supplied for forech() on line 30 invalid address:(to): Caso alguém consiga e possa me ajudar vou postar o código que estou utilizando abaixo: <?php include_once "conectar.php"; $cpf = $_POST['cpf']; $email = $_POST['email']; $select = "SELECT * FROM Corretor WHERE cpf = :CPF or email = :EMAIL"; $result = $conexao->prepare($select); $result->bindParam(':CPF', $cpf); $result->bindParam(':EMAIL', $email); $result->execute(); $contar = $result->rowCount(); if($contar > 0) { foreach ($conexao->query($select) as $exibe); $id_user = $exibe['id']; $cpf_user = $exibe['cpf']; $nome_user = $exibe['nome']; $senha_user = $exibe['senha']; $email_user = $exibe['email']; $telefone = $exibe['telefone']; $cep = $exibe['cep']; $rua = $exibe['rua']; $n = $exibe['n']; $bairro = $exibe['bairro']; $cidade = $exibe['cidade']; $estado = $exibe['estado']; $cod = $exibe['cod']; require("PHPMailer-master/src/PHPMailer.php"); require("PHPMailer-master/src/SMTP.php"); $mail = new PHPMailer\PHPMailer\PHPMailer(); $mail->IsSMTP(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail $mail->Host = "br320.hostgator.com.br"; $mail->Port = 465; // or 587 $mail->IsHTML(true); $mail->Username = "no-reply@linoos.com.br"; $mail->Password = ""; $mail->SetFrom("no-reply@linoos.com.br"); $mail->Subject = "App Linoos - Senha "; $mail->Body = "Conforme solicitado, segue a senha do seu cadastro:" . $senha_user; $mail->AddAddress($email_user); if(!$mail->Send()) { echo json_encode(array("SEN"=>"erro")); echo "Mailer Error: " . $mail->ErrorInfo; }else{ echo json_encode(array("SEN"=>"sucesso")); } }else{ echo json_encode(array("SEN"=>"invalido")); }
  14. Boa tarde, estou com probleminha no phpmailer, o código abaixo funciona corretamente quando consigo enviar para um único e-mail, mas quando coloco a opção todos, ele só manda apenas para primeiro e-mail e não apresenta nenhum erro. Poderia me dar uma ajudinha? Obrigada Controle if ($_POST['filtro'] == 'todos') { // essa consulta pego a lista de e-mails cadastrado no meu banco de dados $usuarios->consultar("select * from mala_email"); $linha = $usuarios->Linha; $rs = $usuarios->Result; } if ($_POST['filtro'] == 'todos') { for ($i=0; $i<$linha; $i++) { $email = $rs[$i]['email']; $mensagem = $_POST['editor']; $util->EnviarEmaiLivre($email, utf8_decode($_POST['assunto']), $mensagem); } } else { $mensagem = $_POST['editor']; $util->EnviarEmaiLivre($_POST['email'], utf8_decode($_POST['assunto']), $mensagem); } Função function EnviarEmaiLivre($email, $assunto, $mensagem) { date_default_timezone_set('Etc/UTC'); require 'phpmailer/PHPMailerAutoload.php'; $hostSmtp = "mail.domino.com.br"; $smtpUser = "email@email.com.br"; $senhaSmtp = "********"; $mensagem = ' <p><img src="http://www.dominio.com.br/images/logodolugar.png" alt="Logo do Lugar" width="550"></p> '.$mensagem; //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 0; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = $hostSmtp; // use // if your network does not support SMTP over IPv6 //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = 587; //Set the encryption system to use - ssl (deprecated) or tls $mail->SMTPSecure = 'tsl'; //Whether to use SMTP authentication $mail->SMTPAuth = true; //Username to use for SMTP authentication - use full email address for gmail $mail->Username = $smtpUser; //Password to use for SMTP authentication $mail->Password = $senhaSmtp; //Set who the message is to be sent from $mail->setFrom('email@email.com.br', 'E-mail do Lugar'); //Set who the message is to be sent to $mail->addAddress($email); //Set the subject line $mail->Subject = $assunto; //Replace the plain text body with one created manually $mail->Body = $mensagem; $mail->isHTML(true); if ($conteudoArquivo != '' && $arquivo != '') { //Attach an image file $mail->addAttachment('phpmailer/images/phpmailer_mini.png'); //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); } if (!$mail->send()) { $retorno = false; } else { $retorno = true; } }
  15. Boa tarde, estou com probleminha no phpmailer, o código abaixo funciona corretamente quando consigo enviar para um único e-mail, mas quando coloco a opção todos, ele só manda apenas para primeiro e-mail e não apresenta nenhum erro. Poderia me dar uma ajudinha? Obrigada Controle if ($_POST['filtro'] == 'todos') { // essa consulta pego a lista de e-mails cadastrado no meu banco de dados $usuarios->consultar("select * from mala_email"); $linha = $usuarios->Linha; $rs = $usuarios->Result; } if ($_POST['filtro'] == 'todos') { for ($i=0; $i<$linha; $i++) { $email = $rs[$i]['email']; $mensagem = $_POST['editor']; $util->EnviarEmaiLivre($email, utf8_decode($_POST['assunto']), $mensagem); } } else { $mensagem = $_POST['editor']; $util->EnviarEmaiLivre($_POST['email'], utf8_decode($_POST['assunto']), $mensagem); } Função function EnviarEmaiLivre($email, $assunto, $mensagem) { date_default_timezone_set('Etc/UTC'); require 'phpmailer/PHPMailerAutoload.php'; $hostSmtp = "mail.domino.com.br"; $smtpUser = "email@email.com.br"; $senhaSmtp = "********"; $mensagem = ' <p><img src="http://www.dominio.com.br/images/logodolugar.png" alt="Logo do Lugar" width="550"></p> '.$mensagem; //Create a new PHPMailer instance $mail = new PHPMailer; //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 0; //Ask for HTML-friendly debug output $mail->Debugoutput = 'html'; //Set the hostname of the mail server $mail->Host = $hostSmtp; // use // if your network does not support SMTP over IPv6 //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = 587; //Set the encryption system to use - ssl (deprecated) or tls $mail->SMTPSecure = 'tsl'; //Whether to use SMTP authentication $mail->SMTPAuth = true; //Username to use for SMTP authentication - use full email address for gmail $mail->Username = $smtpUser; //Password to use for SMTP authentication $mail->Password = $senhaSmtp; //Set who the message is to be sent from $mail->setFrom('email@email.com.br', 'E-mail do Lugar'); //Set who the message is to be sent to $mail->addAddress($email); //Set the subject line $mail->Subject = $assunto; //Replace the plain text body with one created manually $mail->Body = $mensagem; $mail->isHTML(true); if ($conteudoArquivo != '' && $arquivo != '') { //Attach an image file $mail->addAttachment('phpmailer/images/phpmailer_mini.png'); //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__)); } if (!$mail->send()) { $retorno = false; } else { $retorno = true; } }
  16. vinihhylian0103

    ENVIAR EMAIL COM ARQUIVOS ANEXOS VIA PHP

    Eu estou usando esse código: <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <title>Enviar e-mail com anexo</title> </head> <body> <form id="form1" name="form1" method="post" action="?acao=enviar" enctype="multipart/form-data"> <table width="500" border="0" align="center" cellpadding="0" cellspacing="2"> <tr> <td align="right">Nome:</td> <td><input type="text" name="nome" id="nome" /></td> </tr> <tr> <td align="right">Assunto:</td> <td><input type="text" name="assunto" id="assunto" /></td> </tr> <tr> <td align="right">Mensagem:</td> <td><textarea name="mensagem" id="mensagem" cols="45" rows="5"></textarea></td> </tr> <tr> <td align="right">Anexo:</td> <td><input type="file" id="arquivo" name="arquivo" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Enviar" /></td> </tr> </table> </form> <?php if($_GET['acao'] == 'enviar'){ $nome = $_POST['nome']; $assunto = $_POST['assunto']; $mensagem = $_POST['mensagem']; $arquivo = $_FILES["arquivo"]; $corpoMSG = "<strong>Nome:</strong> $nome<br> <strong>Mensagem:</strong> $mensagem"; // chamada da classe require_once('class.phpmailer.php'); // instanciando a classe $mail = new PHPMailer(); // email do remetente $mail->SetFrom('remetente@dominio.com.br', 'remetente'); // email do destinatario $address = "destinatario@dominio.com.br"; $mail->AddAddress($address, "destinatario"); // assunto da mensagem $mail->Subject = $assunto; // corpo da mensagem $mail->MsgHTML($corpoMSG); // anexar arquivo $mail->AddAttachment($arquivo['tmp_name'], $arquivo['name'] ); if(!$mail->Send()) { echo "Erro: " . $mail->ErrorInfo; } else { echo "Mensagem enviada com sucesso!"; } } ?> </body> </html> E estou recebendo o seguinte erro: ( ! ) Notice: Undefined index: acao in C:\wamp\www\EMAILL\email.php on line 33 Call Stack # Time Memory Function Location 1 0.0020 386856 {main}( ) ...\email.php:0 Alguém poderia me ajudar por favor!
  17. kenio Junio

    Como adicionar Foreach no envio de email

    Olá, esta dando erro no foreach dessa variavel $Mailer->Body = ' <div style="float:left;width: 100%;"> <h3 style="margin: 14px 0px 0px 0px;padding: 10px 0px 7px 13px;background: #D2D2D2;color: #404040;">Dados de Quem fez o pedido</h3> <table border="0" cellpadding="0" cellspacing="0" style="float:left; width:100%;border: 1px solid #cccccc;"> <tr> <td style="padding: 10px;">Nome:</td> <td>'.$nome.' '.$sobrenome.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$cpf.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$email.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$numero.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$complmento.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$bairro.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$cidade.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$estado.'<td> <tr> <tr> <td style="padding: 10px;">CPF:</td> <td>'.$cep.'<td> <tr> </table> <table style="width: 100%;float: left;" border="0" cellpadding="0" cellspacing="0"> <thead style="background: #555;"> <tr> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Imagem </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Produto </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Valor(Unidade) </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> SubTotal </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Quantidade </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Peso </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Tamanho </th> <th style="padding: 11px 9px;color: rgba(255, 255, 255, 0.87);font-weight: 300;"> Cor </th> </tr> </thead> <tbody>' 153 foreach ($produtos as $indice => $dados) { list($id, $opcoes) = explode(':', $indice); $qtd = $dados['qtd'];' <tr> <td style="padding: 8px!important;"> <img src="'echo PATCH.'/produto/'.$dados['imagem'];'" width="60"> </td> <td> <span style="text-align: left;padding: 0 0 0 19px;overflow: hidden;width: 105px;text-overflow: ellipsis;white-space: nowrap;float: left;" title="'echo $dados['titulo'];'"> 'echo $dados['titulo'];' </span> <td> <td style="width: 113px;">'.$dados['preco'].'</td> <td style="width: 113px;">'.$dados['subtotal'].'</td> <td style="width: 87px;">'.$dados['qtd'].;'</td> <td style="width: 79px;">'.$dados['peso'].' g</td> <td style="width: 78px;">'.$dados['tamanho'].'</td> <td style="width: 65px;">'.$dados['cor'].'</td> </tr> '.}.' </tbody> </table> </div>'; Parse error: syntax error, unexpected T_FOREACH in gostaria de sabe como corrigir o erro OBRIGADO PELA ATENÇÃO
  18. alisonalves

    Problemas ao enviar anexos com phpmailer?

    Coloquei este código "$arquivo = $_FILES['arquivo'];" no meu phpmailer para anexar arquivos à mensagem mas não está funcionando. Alguém pode me ajudar a enxergar onde estou errando? O códig completo do phpmailer segue abaixo. <?php # Inclui o arquivo class.phpmailer.php localizado na pasta phpmailer require_once("class.phpmailer.php"); require_once("class.smtp.php"); # Inicia a classe PHPMailer $mail = new PHPMailer(); # Define os dados do servidor e tipo de conexão $mail->IsSMTP(); // Define que a mensagem será SMTP $mail->Host = "email-ssl.com.br"; # Endereço do servidor SMTP $mail->Port = 587; // Porta TCP para a conexão $mail->SMTPAutoTLS = false; // Utiliza TLS Automaticamente se disponível $mail->SMTPAuth = true; # Usar autenticação SMTP - Sim $mail->Username = 'contato@xx.com.br'; # Usuário de e-mail $mail->Password = 'xxx'; // # Senha do usuário de e-mail # Define o remetente (você) $mail->From = "contato@xxx.com.br"; # Seu e-mail $mail->FromName = "E-mail de contato"; // Seu nome # Define os destinatário(s) $mail->AddAddress('contato@xxx.com.br', 'Fulano da Silva'); # Os campos podem ser substituidos por variáveis #$mail->AddAddress('webmaster@nomedoseudominio.com'); # Caso queira receber uma copia #$mail->AddCC('ciclano@site.net', 'Ciclano'); # Copia #$mail->AddBCC('fulano@dominio.com.br', 'Fulano da Silva'); # Cópia Oculta // Definição de HTML/codificação $mail->IsHTML(true); // Define que o e-mail será enviado como HTML $mail->CharSet = 'utf-8'; // Charset da mensagem (opcional) // DEFINIÇÃO DA MENSAGEM $mail->Subject = "Classificados"; // Assunto da mensagem $mail->Body .= " titulo: ".nl2br($_POST['titulo'])."<br>"; // Texto da mensagem $mail->Body .= " valor: ".nl2br($_POST['valor'])."<br>"; // Texto da mensagem $mail->Body .= " cidade: ".nl2br($_POST['cidade'])."<br>"; // Texto da mensagem $mail->Body .= " estado: ".nl2br($_POST['estado'])."<br>"; // Texto da mensagem $mail->Body .= " area: ".nl2br($_POST['area'])."<br>"; // Texto da mensagem $mail->Body .= " num_lugares: ".nl2br($_POST['num_lugares'])."<br>"; // Texto da mensagem $mail->Body .= " aluguel_valor: ".nl2br($_POST['aluguel_valor'])."<br>"; // Texto da mensagem $mail->Body .= " aluguel_contrato: ".nl2br($_POST['aluguel_contrato'])."<br>"; // Texto da mensagem $mail->Body .= " num_funcionarios: ".nl2br($_POST['num_funcionarios'])."<br>"; // Texto da mensagem $mail->Body .= " iptu: ".nl2br($_POST['iptu'])."<br>"; // Texto da mensagem $mail->Body .= " faturamento: ".nl2br($_POST['faturamento'])."<br>"; // Texto da mensagem $mail->Body .= " site: ".nl2br($_POST['site'])."<br>"; // Texto da mensagem $mail->Body .= " detalhes: ".nl2br($_POST['detalhes'])."<br>"; // Texto da mensagem $mail->Body .= " nome: ".nl2br($_POST['nome'])."<br>"; // Texto da mensagem $mail->Body .= " telefone: ".nl2br($_POST['telefone'])."<br>"; // Texto da mensagem $mail->Body .= " email: ".nl2br($_POST['email'])."<br>"; // Texto da mensagem $arquivo = $_FILES['arquivo']; # Define os dados técnicos da Mensagem $mail->IsHTML(true); # Define que o e-mail será enviado como HTML #$mail->CharSet = 'iso-8859-1'; # Charset da mensagem (opcional) # Define os anexos (opcional) #$mail->AddAttachment("c:/temp/documento.pdf", "documento.pdf"); # Insere um anexo # Envia o e-mail $enviado = $mail->Send(); # Limpa os destinatários e os anexos $mail->ClearAllRecipients(); $mail->ClearAttachments(); # Exibe uma mensagem de resultado (opcional) if ($enviado) { echo "E-mail enviado com sucesso!"; } else { echo "Não foi possível enviar o e-mail."; echo "<b>Informações do erro:</b> " . $mail->ErrorInfo; } ?>
  19. Hulkstar

    Problema PHPMailer

    Olá, Estou usando o PHPMailer para envio de email smtp através do gmail,o gmail está tudo configurado certinho,o script acredito que esteja configurado de forma correta também,pois eu utilizava o mesmo sistema em um servidor antigo,porém devido eu ter alterado de servidor,agora estou com problema para configurar isso,segue abaixo o script que eu estou usando. eu cheguei a instar o postfix e o sendemail,mais não deu certo,alguém tem alguma ideia que possa estar me ajudando? include("phpmailer/class.phpmailer.php"); include("phpmailer/class.smtp.php"); include("phpmailer/class.pop3.php"); include("phpmailer/PHPMailerAutoload.php"); $ToEmail = ''; $MessageHTML = ''; $MessageTEXT = ''; $Mail = new PHPMailer(); $Mail->IsSMTP(); $Mail->Host = "smtp.gmail.com"; $Mail->SMTPAuth = TRUE; $Mail->SMTPSecure = "ssl"; $Mail->Port = 465; $Mail->Username = ''; $Mail->Password = ''; $Mail->Priority = 1; $Mail->CharSet = 'UTF-8'; $Mail->Encoding = '8bit'; $Mail->Subject = ''; $Mail->ContentType = 'text/html; charset=utf-8\r\n'; $Mail->From = ''; $Mail->FromName = ''; $Mail->WordWrap = 900; $Mail->AddAddress($ToEmail); $Mail->isHTML(TRUE); $Mail->Body = $MessageHTML; $Mail->AltBody = $MessageTEXT; $Mail->Send(); $Mail->SmtpClose(); Obrigado!
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.