Advertisement
Guest User

Untitled

a guest
Dec 20th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. $_SESSION['nomecomp'] = $_POST['nomecomp'];
  4.  
  5. $email_env = $_POST['email_env'];
  6. if (isset($email_env)) {
  7. //variaveis vindas da pagina
  8. $varcritico = $_POST['varcritico'];
  9. $nomecomp = $_POST['nomecomp'];
  10. $chapa = $_POST['chapa'];
  11. $funcao = $_POST['funcao'];
  12. $setor = $_POST['setor'];
  13. $unidade = $_POST['unidade'];
  14. $deschelp = $_POST['deschelp'];
  15.  
  16.  
  17.  
  18.  
  19.  
  20. //variveis do modal
  21. //$email_env = $_POST['email_env'];
  22. //$senha_env = $_POST['senha_env'];
  23.  
  24.  
  25.  
  26. //variaveis para envio email
  27. //$sen_name = "thundhawk@gmail.com";
  28. //$sen_email = "thundhawk@gmail.com";
  29. //$rec_email = "thundhawk@gmail.com";
  30. $box_msg = "<html><body><table width='100%' border='2' cellspacing='2' cellpadding='2'>
  31. <tr>
  32. <th bgcolor='#C1E1A6'>Criticidade</th>
  33. <th bgcolor='#C1E1A6'>Nome Completo</th>
  34. <th bgcolor='#C1E1A6'>Chapa</th>
  35. <th bgcolor='#C1E1A6'>Funcao</th>
  36. <th bgcolor='#C1E1A6'>Setor</th>
  37. <th bgcolor='#C1E1A6'>Unidade</th>
  38. <th bgcolor='#C1E1A6'>Descricao</th>
  39.  
  40.  
  41. </tr>
  42. <tr>
  43. <td>$varcritico</td>
  44. <td>$nomecomp</td>
  45. <td>$chapa</td>
  46. <td>$funcao</td>
  47. <td>$setor</td>
  48. <td>$unidade</td>
  49. <td>$deschelp</td>
  50.  
  51.  
  52.  
  53. </tr>
  54. </table>'";
  55.  
  56. /**
  57. * PHPMailer multiple files upload and send example
  58. */
  59.  
  60. $msg = '';
  61. //if (array_key_exists('userfile', $_FILES)) {
  62.  
  63. // Create a message
  64. // This should be somewhere in your include_path
  65. include ("lib/PHPMailerAutoload.php");
  66. $mail = new PHPMailer();
  67. $mail->IsSMTP();
  68. $mail->SMTPDebug = 0;
  69. $mail->Mailer = "smtp";
  70. $mail->Host = "smtp.gmail.com";
  71. $mail->Port = 465;
  72.  
  73. // Enable SMTP authentication
  74. $mail->SMTPAuth = true;
  75.  
  76. // SMTP username (e.g xyz@gmail.com)
  77. $mail->Username = 'thundhawk@gmail.com';
  78.  
  79. // SMTP password
  80. $mail->Password = '';
  81.  
  82. // Enable encryption, 'tls' also accepted
  83. $mail->SMTPSecure = 'ssl';
  84.  
  85. // Sender Email address
  86. $mail->From = 'thundhawk@gmail.com';
  87.  
  88. // Sender name
  89. $mail->FromName = 'thundhawk@gmail.com';
  90.  
  91. // Receiver Email address
  92. $mail->addAddress('thundhawk@gmail.com');
  93.  
  94.  
  95.  
  96.  
  97. //Attach multiple files one by one
  98. for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) {
  99. $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'][$ct]));
  100. $filename = $_FILES['userfile']['name'][$ct];
  101. if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
  102. $mail->addAttachment($uploadfile, $filename);
  103. } else {
  104. $msg .= 'Failed to move file to ' . $uploadfile;
  105. }
  106. }
  107.  
  108.  
  109. $mail->Body = $box_msg;
  110. $mail->IsHTML(true);
  111. $mail->WordWrap = 50;
  112.  
  113.  
  114. if (!$mail->send()) {
  115. $msg .= "Mailer Error: " . $mail->ErrorInfo;
  116. echo 'erro de email';
  117. } else {
  118. $msg .= "Message sent!";
  119. echo 1;
  120. }
  121. }
  122. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement