Copy link to clipboard
Copied
Hello,
I'm building a site in which the user has to enter personal information, upload that information into a MySQL DB, and at the end send a conformation e-mail to the user.
So far things are working properly, but I'm still unable to make the system to send the confirmation e-mail in HTML format. My code is as follows:
<?php
$id = $row_rsMision2010['ID'];
$Nombre = $row_rsMision2010['Nombre'];
$Apellido = $row_rsMision2010['Apellido1'];
$Agencia = $row_rsMision2010['Agencia'];
$Direccion = $row_rsMision2010['Direccion'];
$Colonia = $row_rsMision2010['Colonia'];
$Ciudad = $row_rsMision2010['Ciudad'];
$Estado = $row_rsMision2010['Estado'];
$CP = $row_rsMision2010['CP'];
$Lada = $row_rsMision2010['Lada'];
$Telefono = $row_rsMision2010['Telefono'];
$Puesto = $row_rsMision2010['Puesto'];
$Reserva = $row_rsMision2010['Reserva'];
$to = $row_rsMision2010['Mail'];
$subject = "Codigo de Reservacion Registro La Mision 2010 Las Vegas Evolution";
$headers = "De: Oficina de Turismo de Las Vegas para Mexico y Centroamerica" .
"MIME-Version: 1.0rn" .
"Content-type: text/html; charset=UTF-8";
$body = "<html><body>" .
"<h2>Su registro ha sido exitosamente recibido en nuestro sistema.<h2/>" .
"<p>Sus datos registrados son los siguientes:</p>" .
"<p>Nombre: '$Nombre'</p>" .
"<p>Apellidos: '$Apellido'</p>" .
"<p>Agencia: '$Agencia'</p>" .
"<p>Dirección: '$Dirección'</p>" .
"<p>Colonia: '$Colonia'</p>" .
"<p>Ciudad: '$Ciudad'</p>" .
"<p>Estado: '$Estado'</p>" .
"<p>C.P.: '$CP'</p>" .
"<p>Teléfono: '$Lada' - '$Telefono'</p>" .
"<p>Puesto: '$Puesto'</p>" .
"<p>Su Código único e intransferible de admisión es: '$Reserva'</p>" .
"<p>¡No olvide imprimirlo y mostrarlo junto con su identificación oficial a su llegada al evento!</p>" .
"</body></html>";
mail($to, $subject, $body, $headers);
?>
As far as I understand, I might be mistyping something, or having a syntax error while defining the $body variable.
Could someone help me out and check what am I doing wrong?
Thanks for your support in advance.
Copy link to clipboard
Copied
Each header needs to be on a separate line. You have simply concatenated them together as a single string.
$headers = "De: Oficina de Turismo de Las Vegas para Mexico y Centroamerica" .
"MIME-Version: 1.0rn" .
"Content-type: text/html; charset=UTF-8";
This should be:
$headers = "From: Oficina de Turismo de Las Vegas para Mexico y Centroamerica\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-type: text/html; charset=UTF-8";
Copy link to clipboard
Copied
Thank you so much!
Sure it worked!