Advertisement
Guest User

codigo

a guest
Feb 29th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.72 KB | None | 0 0
  1. <?php
  2.    
  3.     date_default_timezone_set('Etc/UTC');
  4.  
  5.     require 'PHPMailer-master/PHPMailerAutoload.php';
  6.  
  7.     //Create a new PHPMailer instance
  8.     $mail = new PHPMailer;
  9.     //Tell PHPMailer to use SMTP
  10.     $mail->isSMTP();
  11.     //Enable SMTP debugging
  12.     // 0 = off (for production use)
  13.     // 1 = client messages
  14.     // 2 = client and server messages
  15.     $mail->SMTPDebug = 2;
  16.     //Ask for HTML-friendly debug output
  17.     $mail->Debugoutput = 'html';
  18.     //Set the hostname of the mail server
  19.     $mail->Host = "184.154.150.68";
  20.     //Set the SMTP port number - likely to be 25, 465 or 587
  21.     $mail->Port = 587;
  22.     //Whether to use SMTP authentication
  23.     $mail->SMTPAuth = true;
  24.     //Username to use for SMTP authentication
  25.     $mail->Username = "no-reply@dev.agfmartins.com.br";
  26.     //Password to use for SMTP authentication
  27.     $mail->Password = "f00martins";
  28.     //Set who the message is to be sent from
  29.     $mail->setFrom(trim($_POST['email_remetente']), $_POST['nome_remetente']);
  30.     //Set an alternative reply-to address
  31.     // $mail->addReplyTo('replyto@example.com', 'First Last');
  32.     //Set who the message is to be sent to
  33.     $mail->addAddress(trim($_POST['email_destinatario']), $_POST['nome_destinatario']);
  34.     //Set the subject line
  35.     $mail->Subject = $_POST['assunto'];
  36.     //Read an HTML message body from an external file, convert referenced images to embedded,
  37.     //convert HTML into a basic plain-text alternative body
  38.     $mail->msgHTML('<div style="text-align: center;"><img src="http://dev.agfmartins.com.br/loopimoveis.com.br/header.jpg" border="0" alt="" align="center" />
  39. <div style="text-transform: uppercase; font-family: \'Arial\', Verdana; font-weight: bold; text-align: center; font-size: 60px; padding: 20px 0px; color: #58595B;">' . $nomedestinatario . '</div>
  40. <img src="http://dev.agfmartins.com.br/loopimoveis.com.br/meio.jpg" border="0" alt="" align="center" />
  41. <br />
  42. <br />
  43. <br />
  44. <a href="http://dev.agfmartins.com.br/loopimoveis.com.br/MIDIA_KIT.pdf" target="_blank"><img src="http://dev.agfmartins.com.br/loopimoveis.com.br/clique-aqui.jpg" border="0" alt="clique aqui" align="center" /></a>
  45. <br />
  46. <br />
  47. <img src="http://dev.agfmartins.com.br/loopimoveis.com.br/footer.jpg" border="0" alt="" align="center" /></div>');
  48.     //Replace the plain text body with one created manually
  49.     // $mail->AltBody = '';
  50.     //Attach an image file
  51.     // $mail->addAttachment('images/phpmailer_mini.png');
  52.  
  53.     //send the message, check for errors
  54.     if (!$mail->send()) {
  55.     echo "Mailer Error: " . $mail->ErrorInfo;
  56.     } else {
  57.        
  58.         echo '<h1 style="text-align: center;">E-mail enviado com sucesso!</h1>';
  59.         echo '<br />';
  60.         echo '<a href="http://dev.agfmartins.com.br/loopimoveis.com.br/envio.php" style="text-align: center; position: relative; display: table; margin: 0px auto;">Voltar</a>';
  61.  
  62.     }
  63.  
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement