Advertisement
Guest User

email smtp

a guest
Feb 23rd, 2016
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. <?php
  2. if($_POST){
  3. require 'email/PHPMailerAutoload.php';
  4.  
  5. $mail = new PHPMailer;
  6.  
  7. $nome = $_POST['nome'];
  8. $email = $_POST['email'];
  9. $telefone = $_POST['telefone'];
  10. $assunto = $_POST['assunto'];
  11.  
  12. //$mail->SMTPDebug = 3; // Enable verbose debug output
  13.  
  14. $mail->isSMTP(); // Set mailer to use SMTP
  15. $mail->Host = 'smtpi.uni5.net'; // Specify main and backup SMTP servers
  16. $mail->SMTPAuth = true; // Enable SMTP authentication
  17. $mail->Username = 'contato@iainet.com.br'; // SMTP username
  18. $mail->Password = 'xxxxxxx'; // SMTP password
  19. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  20. $mail->Port = 587; // TCP port to connect to
  21.  
  22. $mail->setFrom('contato@iainet.com.br', 'iaiNet');
  23. $mail->addAddress('andre@iainet.com.br', 'Andre'); // Add a recipient
  24. $mail->addAddress('financeiro@asainovacao.com.br', 'Jackeline'); // Add a recipient
  25. $mail->addAddress('byte@iainet.com.br', 'Byte'); // Add a recipient
  26. $mail->addAddress('marcel@iainet.com.br', 'Marcel'); // Add a recipient
  27. $mail->addAddress('fabio@iainet.com.br', 'Fabio'); // Add a recipient
  28. $mail->addReplyTo('contato@iainet.com.br', 'iaiNet');
  29. // $mail->addCC('cc@example.com');
  30. // $mail->addBCC('bcc@example.com');
  31.  
  32. // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  33. // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  34. $mail->isHTML(true); // Set email format to HTML
  35.  
  36. $mail->Subject = '[iaiNet] Contato - site';
  37. $mail->Body = '<b>Nome</b>: '.$nome.' <br> <b>Email</b>: '.$email.' <br> <b>Telefone</b>: '.$telefone.' <br> <b>Assunto</b>: '.$assunto.' <br><br> Pagina: '.$_SERVER['HTTP_REFERER'].' <br><br> att,<br>iaiNet';
  38. $mail->AltBody = 'Nome: '.$nome.' | Email: '.$email.' | Telefone: '.$telefone.' | Assunto: '.$assunto.' | att, iaiNet';
  39.  
  40. if(!$mail->send()) {
  41. echo 'Houve um erro ao enviar a mensagem';
  42. echo 'Mailer Error: ' . $mail->ErrorInfo;
  43. } else {
  44. // echo 'Message has been sent';
  45. header('Location: '.$_SERVER['HTTP_REFERER'].'?msg=sucesso');
  46. }
  47. }
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement