Guest User

Untitled

a guest
Nov 22nd, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. //Acentuação
  2. $mail->Subject = utf8_decode($assunto);
  3. $mail->Body = utf8_decode($html);
  4. $html = '=?UTF-8?B?'.base64_encode($html).'?=';
  5.  
  6. <?php
  7.  
  8.  
  9. //incluir o phpmailer
  10. require_once("phpMailer/PHPMailerAutoload.php");
  11.  
  12. //criar instancia do phpmailer
  13. $mail = new PHPMailer();
  14.  
  15. //Acentuação
  16. //$mail->Subject = utf8_decode($assunto);
  17. $mail->Body = utf8_decode($html);
  18. //$html = '=?UTF-8?B?'.base64_encode($html).'?=';
  19.  
  20.  
  21. // Mensagem formatada, enviada no corpo do email =================================================================================
  22. $html = "<!DOCTYPE html>
  23. <html>
  24. <head>
  25. <style>
  26. body {background:#FFFFFF;}
  27. a, a:link {color:#5b6105; text-decoration:none;}
  28. #tab {margin:0; padding:0px; width:500px; border:1px solid #8F8E96; padding:10px;}
  29. #tab tr {background:#F6F6F6; }
  30. #tab td {color:#000000; font: normal 20px arial, helvetica, sans-serif; border:dashed 1px #DDD; padding:30px;}
  31. </style>
  32. </head>
  33. <body>
  34. <br />
  35. <table border='0' cellspacing='10' cellpadding='0' id='tab' align='center'>
  36. <tr>
  37. <td>
  38. <b>Data:</b>{$_POST['Datas']}<br />
  39. <b>Módulo:</b>{$_POST['Modulo']}<br />
  40. <b>Assunto/Script:</b>{$_POST['AssuntoScript']}<br />
  41. <b>Descrição/Alteração:</b>{$_POST['DescricaoAlteracao']}<br />
  42. <b>Script/Informação:</b>{$_POST['ScriptInformacao']}<br />
  43. <b>Responsável:</b>{$_POST['Responsavel']}<br />
  44. <b>Tipo:</b>{$_POST['Tipo']}<br />
  45. <b>Origem:</b>{$_POST['Origem']}<br />
  46. </td>
  47. </tr>
  48. </table>
  49. <br />
  50. </body>
  51. </html>
  52. ";
  53.  
  54.  
  55.  
  56. //criar variável do Anexo
  57. $arquivo = $_FILES['arquivo'];
  58.  
  59.  
  60. //habilitar SMTP
  61. $mail->isSMTP();
  62.  
  63. $mail->SMTPOptions = array (
  64. 'ssl' => array(
  65. 'verify_peer'=> false,
  66. 'verify_peer_name' =>false,
  67. 'allow_self_signed' =>true
  68. )
  69. );
  70.  
  71. //debug para informar os erros
  72. $mail->SMTPDebug=2; // 0-nada 1-msg cliente e servidor 3-tudo
  73.  
  74.  
  75. //Host
  76. $mail->Host = 'xxxxxxxxxxxxx';
  77.  
  78. //tipo de proteção
  79. //$mail->SMTPSecure = "tls";
  80.  
  81. //porta
  82. $mail-> Port = 25;
  83.  
  84. //autenticação
  85. //$mail->SMTPAuth = true;
  86.  
  87. //detalhes da conta de email
  88. //$mail->Username='xxxxx';
  89. //$mail->Password='xxxxx';
  90.  
  91. //detalhes do email
  92. $mail->isHTML(true);
  93. $mail->setFrom ('xxxxxx@xxxxx.xxxx.br', 'xxxxxx');
  94. $mail->addAddress ('xxxxxxxxxxxxxxxx');
  95. $mail->Subject = 'Solicitação de Alterações';
  96. $mail->AddAttachment($arquivo['tmp_name'], $arquivo['name'] );
  97. $mail->Body = $html;
  98.  
  99. //mensagem de envio ou erro
  100. if ($mail->send())
  101. echo "email enviado com sucesso";
  102. else echo "Deu ruim";
  103.  
  104. ?>
  105.  
  106.  
  107.  
  108. </html>
Add Comment
Please, Sign In to add comment