<?php 
  $correo =$_POST['email'];
  $pass =$_POST['proceso_compra'];
  $rut = $_POST['rut'];
  $list=array($correo);
 $procesocompra ="<span>Estimado Cliente,&nbsp;<br>&nbsp;&nbsp;Sus datos para ingresar al sistema de postventa son:<br>
                        Usuario:<b>".$rut."</b><br>
                          Clave:<b>".$pass."</b><br><br>
                        Le recordamos que la contraseña corresponde al número del PROCESO DE COMPRA indicado en todos<br>
                          los documentos que ha suscrito con la inmobiliaria </span>";
$cuerpo ="<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<html xmlns=http://www.w3.org/1999/xhtml>
    <head>
        <meta http-equiv=Content-Type content=text/html; charset=UTF-8 />
        <meta name=viewport content=width=device-width/>
        <title>Postventa</title>
        <style type=text/css>
      /*////// RESET STYLES //////*/
      body, #bodyTable, #bodyCell{height:100% !important; margin:0; padding:0; width:100% !important;}
      table{border-collapse:collapse;}
      img, a img{border:0; outline:none; text-decoration:none;}
      h1, h2, h3, h4, h5, h6{margin:0; padding:0;}
      p{margin: 1em 0;}

      /*////// CLIENT-SPECIFIC STYLES //////*/
      .ReadMsgBody{width:100%;} .ExternalClass{width:100%;} /* Force Hotmail/Outlook.com to display emails at full width. */
      .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div{line-height:100%;} /* Force Hotmail/Outlook.com to display line heights normally. */
      table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;} /* Remove spacing between tables in Outlook 2007 and up. */
      #outlook a{padding:0;} /* Force Outlook 2007 and up to provide a view in browser message. */
      img{-ms-interpolation-mode: bicubic;} /* Force IE to smoothly render resized images. */
      body, table, td, p, a, li, blockquote{-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%;} /* Prevent Windows- and Webkit-based mobile platforms from changing declared text sizes. */

      /*////// FRAMEWORK STYLES //////*/
      .flexibleContainerCell{padding-top:20px; padding-Right:20px; padding-Left:20px;}
      .flexibleImage{height:auto;}
      .bottomShim{padding-bottom:20px;}
      .imageContent, .imageContentLast{padding-bottom:20px;}
      .nestedContainerCell{padding-top:20px; padding-Right:20px; padding-Left:20px;}

      /*////// GENERAL STYLES //////*/
      body, #bodyTable{background-color:#F5F5F5;}
      #bodyCell{padding-top:40px; padding-bottom:40px;}
      #emailBody{background-color:#FFFFFF; border:1px solid #DDDDDD; border-collapse:separate; border-radius:4px;}
      h1, h2, h3, h4, h5, h6{color:darkorange; font-family:Helvetica; font-size:20px; line-height:125%; text-align:center;}
      .textContent, .textContentLast{color:#606060; font-family:Helvetica; font-size:16px; line-height:125%; text-align:Left; padding-bottom:20px;}
      .textContent a, .textContentLast a{color:#2C9AB7; text-decoration:underline;}
      .nestedContainer{background-color:#E5E5E5; border:1px solid #CCCCCC;}
      .emailButton{background-color:#2C9AB7; border-collapse:separate; border-radius:4px;}
      .buttonContent{color:#FFFFFF; font-family:Helvetica; font-size:18px; font-weight:bold; line-height:100%; padding:15px; text-align:center;}
      .buttonContent a{color:#FFFFFF; display:block; text-decoration:none;}
      .emailCalendar{background-color:#FFFFFF; border:1px solid #CCCCCC;}
      .emailCalendarMonth{background-color:#2C9AB7; color:#FFFFFF; font-family:Helvetica, Arial, sans-serif; font-size:16px; font-weight:bold; padding-top:10px; padding-bottom:10px; text-align:center;}
      .emailCalendarDay{color:#2C9AB7; font-family:Helvetica, Arial, sans-serif; font-size:60px; font-weight:bold; line-height:100%; padding-top:20px; padding-bottom:20px; text-align:center;}
      @media only screen and (max-width: 480px){      
        body{width:100% !important; min-width:100% !important;} 
        table[id=emailBody], table[class=flexibleContainer]{width:100% !important;}
        img[class=flexibleImage]{height:auto !important; width:100% !important;}
        table[class=emailButton]{width:100% !important;}
        td[class=buttonContent]{padding:0 !important;}
        td[class=buttonContent] a{padding:15px !important;}
        td[class=textContentLast], td[class=imageContentLast]{padding-top:20px !important;}
        td[id=bodyCell]{padding-top:10px !important; padding-Right:10px !important; padding-Left:10px !important;}
      }
    </style>
    </head>
    <body>
      <center>
          <table border=0 cellpadding=0 cellspacing=0 height=100% width=100% id=bodyTable>

              <tr>
                              <td align=center valign=top>
                                  <!-- CENTERING TABLE // -->
                                  <table border=0 cellpadding=0 cellspacing=0 width=100%>
                                      <tr>
                                          <td align=center valign=top>
                                              <!-- FLEXIBLE CONTAINER // -->
                                              <table border=0 cellpadding=0 cellspacing=0 width=600 class=flexibleContainer>
                                                  <tr>
                                                      <td align=center valign=top width=600 class=flexibleContainerCell bottomShim>
                                                          <table border=0 cellpadding=0 cellspacing=0 width=100% class=nestedContainer>
                                                              <tr>
                                                                  <td align=center valign=top class=nestedContainerCell>


                                                                        <!-- CONTENT TABLE // -->
                                                                        <table border=0 cellpadding=0 cellspacing=0 width=100%>
                                                                            <tr>
                                                                                <td valign=top class=imageContent>
                                                                                    <img src=http://i.imgur.com/hOUEzCs.jpg width=520 class=flexibleImage style=max-width:520px; />
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td valign=top class=textContent>
                                                                                    <h3>Post venta Inmobiliaria Todos los Santos</h3>
                                                                                    <br />".$procesocompra."

                                                                                </td>
                                                                            </tr>
                                                                                    <tr>
                                                                                <td align=center valign=top class=bottomShim>
                                                                                    <table border=0 cellpadding=0 cellspacing=0 width=260 class=emailButton>
                                                                                        <tr>
                                                                                            <td align=center valign=middle class=buttonContent>
                                                                                                <a href='http://postventa.itodoslossantos.cl/'' target=_blank>Ir a postventa</a>
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                        <!-- // CONTENT TABLE -->
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <!-- // FLEXIBLE CONTAINER -->
                                            </td>
                                        </tr>
                                    </table>
                                    <!-- // CENTERING TABLE -->
                                </td>
                            </tr>
                        </table>
                      <!-- // EMAIL CONTAINER -->
                    </td>
                </tr>
            </table>
        </center>
    </body>
</html>";

    include_once("class.phpmailer.php");
    include_once("class.smtp.php");
    $mail = new PHPMailer();
    $mail->CharSet = "UTF-8";
    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->Host = "mail.itodoslossantos.cl"; // SMTP a utilizar. Por ej. smtp.elserver.com
    $mail->Username = "postventa@itodoslossantos.cl"; // Correo completo a utilizar
    $mail->Password ="VaiN3908"; // Contraseña
    $mail->Port = "25"; // Puerto a utilizar
    $mail->From = "postventa@itodoslossantos.cl"; // Desde donde enviamos (Para mostrar)
    $mail->FromName = "Inmobiliaria Todos los Santos";
    $mail->AddAddress("postventa@vain-arm.cl");
    $mail->IsHTML(true); // El correo se envía como HTML
    $mail->Subject ="Postventa";//'Titulo'; // Este es el titulo del email.
    foreach($list as $bccer){
        $mail->AddBCC($bccer);
    }
    $mail->Body = html_entity_decode($cuerpo); // Mensaje a enviar
    $exito = $mail->Send(); // Envía el correo.
  if($exito){
    echo "El correo fue enviado correctamente.";
  }else{
    echo "Hubo un inconveniente. Contacta a un administrador.";
  }
?>