Foros del Web » Programando para Internet » PHP »

Enviar correo a dos cuentas

Estas en el tema de Enviar correo a dos cuentas en el foro de PHP en Foros del Web. Saludos gentita tengo la siguiente consulta, en php como aria para enviar un mismo mensaje a dos correos diferentes, esperando su apoyo me despido. dejo ...
  #1 (permalink)  
Antiguo 05/07/2010, 10:41
Avatar de frankjoel86  
Fecha de Ingreso: noviembre-2008
Ubicación: Ica
Mensajes: 295
Antigüedad: 15 años, 5 meses
Puntos: 0
Sonrisa Enviar correo a dos cuentas

Saludos gentita tengo la siguiente consulta, en php como aria para enviar un mismo mensaje a dos correos diferentes, esperando su apoyo me despido. dejo el codigo.


<?php
$to = '[email protected]';
$to = '[email protected]';

$name = stripslashes($_POST['txtnombreapellidos']); //sender's name
$email = stripslashes($_POST['txtemail']); //sender's email
$website = stripslashes($_POST['txtdni']); //sender's website
$telefono = stripslashes($_POST['txttelefono']);

$subject = "Asunto - "; //The default subject. Will appear by default in all messages. Change this if you want.
$subject .= stripslashes($_POST['txtasunto']); // the subject


$msg = "From : $name \r\n";
$msg .= "e-Mail : $email \r\n";
$msg .= "Website : $website \r\n";
$msg .= "Website : $telefono \r\n";
$msg .= "Subject : $subject \r\n\n";
$msg .= "---Message--- \r\n".stripslashes($_POST['txtmensaje'])."\r\n\n";
#$hoy=date("M-d-Y");
?>

<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
$self = $_SERVER['PHP_SELF'];
?>

<table border=0 bordercolor=silver width=570 height=50>
<tr>
<td colspan=2> <table width="570" border="0" align="center" cellpadding="5" cellspacing="0" bordercolor="silver">
<tr>
<td valign="top" width="24"><img src="images/telefono.gif" align="middle" /></td><td><strong>Telefonos Fijos: </strong> 056-254000 / 056-252423</p></td>

<?php
} else {
error_reporting(0);
if (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))
//Message sent!
//It the message that will be displayed when the user click the sumbit button
//You can modify the text if you want
echo nl2br("
<div class=\"MsgSent\">
<h1>Mensaje Enviado</h1>
</div>
");
else
// Display error message if the message failed to send
echo "
<div class=\"MsgError\">
<h1>Error!!</h1>
<p>Sorry <b><?=$name;?></b>, Error al enviar el Mensaje</p>
</div>";
}
?>
  #2 (permalink)  
Antiguo 05/07/2010, 11:43
Avatar de wiwi74  
Fecha de Ingreso: marzo-2008
Mensajes: 515
Antigüedad: 16 años, 1 mes
Puntos: 10
Respuesta: Enviar correo a dos cuentas

Código PHP:

//Asi:
$to '[email protected]', '//como son dos ponemos una (,)
$to .= '[email protected]';

//O asi:
$to '[email protected]'.', '.'[email protected]'

Etiquetas: correo, cuentas, dos, enviar
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:12.