¿Como usar mail() para mensajes en HTML?
Hola!!!
Es una pregunta sencilla para expertos en php como ustedes. Cual es la sintaxis que debo usar para indicar a la funcion mail() que se trata de un mensaje en HTML. Creo que se anexa una cabecera pero no se cual.
De ante mano muchas gracias!!!!
Es una pregunta sencilla para expertos en php como ustedes. Cual es la sintaxis que debo usar para indicar a la funcion mail() que se trata de un mensaje en HTML. Creo que se anexa una cabecera pero no se cual.
De ante mano muchas gracias!!!!
Hola Rodrigo
En la página de php.net está todo lo que vos buscas, te paso la dir para futuras consultas:
http://www.php.net
Lo que necesitás es algo así?
/* recipients */
$to = "Mary <[email protected]>" . ", " ; //note the comma
$to .= "Kelly <[email protected]>";
/* subject */
$subject = "Birthday Reminders for August";
/* message */
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
/* additional headers */
$headers .= "From: Birthday Reminder <[email protected]>rn";
$headers .= "Cc: [email protected]";
$headers .= "Bcc: [email protected]";
/* and now mail it */
mail($to, $subject, $message, $headers);
Suerte
Lutian_de_martian
En la página de php.net está todo lo que vos buscas, te paso la dir para futuras consultas:
http://www.php.net
Lo que necesitás es algo así?
/* recipients */
$to = "Mary <[email protected]>" . ", " ; //note the comma
$to .= "Kelly <[email protected]>";
/* subject */
$subject = "Birthday Reminders for August";
/* message */
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";
/* additional headers */
$headers .= "From: Birthday Reminder <[email protected]>rn";
$headers .= "Cc: [email protected]";
$headers .= "Bcc: [email protected]";
/* and now mail it */
mail($to, $subject, $message, $headers);
Suerte
Lutian_de_martian
dios mio! has truinfado llevo toda la tarde buscando por internet la manera de mandar html y no he encontrado respuesta tan contundente y explicada cmom esta. seguid asi . muchas gracias
El código para enviar páginas html es excelente pero como hago si quiero mandarle en la misma página, una o varias imágenes?
