Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- $_SESSION['nomecomp'] = $_POST['nomecomp'];
- $email_env = $_POST['email_env'];
- if (isset($email_env)) {
- //variaveis vindas da pagina
- $varcritico = $_POST['varcritico'];
- $nomecomp = $_POST['nomecomp'];
- $chapa = $_POST['chapa'];
- $funcao = $_POST['funcao'];
- $setor = $_POST['setor'];
- $unidade = $_POST['unidade'];
- $deschelp = $_POST['deschelp'];
- //variveis do modal
- //$email_env = $_POST['email_env'];
- //$senha_env = $_POST['senha_env'];
- //variaveis para envio email
- //$sen_name = "thundhawk@gmail.com";
- //$sen_email = "thundhawk@gmail.com";
- //$rec_email = "thundhawk@gmail.com";
- $box_msg = "<html><body><table width='100%' border='2' cellspacing='2' cellpadding='2'>
- <tr>
- <th bgcolor='#C1E1A6'>Criticidade</th>
- <th bgcolor='#C1E1A6'>Nome Completo</th>
- <th bgcolor='#C1E1A6'>Chapa</th>
- <th bgcolor='#C1E1A6'>Funcao</th>
- <th bgcolor='#C1E1A6'>Setor</th>
- <th bgcolor='#C1E1A6'>Unidade</th>
- <th bgcolor='#C1E1A6'>Descricao</th>
- </tr>
- <tr>
- <td>$varcritico</td>
- <td>$nomecomp</td>
- <td>$chapa</td>
- <td>$funcao</td>
- <td>$setor</td>
- <td>$unidade</td>
- <td>$deschelp</td>
- </tr>
- </table>'";
- /**
- * PHPMailer multiple files upload and send example
- */
- $msg = '';
- //if (array_key_exists('userfile', $_FILES)) {
- // Create a message
- // This should be somewhere in your include_path
- include ("lib/PHPMailerAutoload.php");
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->SMTPDebug = 0;
- $mail->Mailer = "smtp";
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 465;
- // Enable SMTP authentication
- $mail->SMTPAuth = true;
- // SMTP username (e.g xyz@gmail.com)
- $mail->Username = 'thundhawk@gmail.com';
- // SMTP password
- $mail->Password = '';
- // Enable encryption, 'tls' also accepted
- $mail->SMTPSecure = 'ssl';
- // Sender Email address
- $mail->From = 'thundhawk@gmail.com';
- // Sender name
- $mail->FromName = 'thundhawk@gmail.com';
- // Receiver Email address
- $mail->addAddress('thundhawk@gmail.com');
- //Attach multiple files one by one
- for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) {
- $uploadfile = tempnam(sys_get_temp_dir(), sha1($_FILES['userfile']['name'][$ct]));
- $filename = $_FILES['userfile']['name'][$ct];
- if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) {
- $mail->addAttachment($uploadfile, $filename);
- } else {
- $msg .= 'Failed to move file to ' . $uploadfile;
- }
- }
- $mail->Body = $box_msg;
- $mail->IsHTML(true);
- $mail->WordWrap = 50;
- if (!$mail->send()) {
- $msg .= "Mailer Error: " . $mail->ErrorInfo;
- echo 'erro de email';
- } else {
- $msg .= "Message sent!";
- echo 1;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement