buen dia,
he buscado ionformacion al respecto y no encuentro absolutamente nada, por lo que acudo a los expertos en el tema...
resulta que estoy enviando un correo electrónico con adjunto, usando PHP Mail, la que viene con el Mercury y funciona bien; pero solo puedo enviar un adjunto, y necesito enviar almenos dos archivos... como podría modificar mi código para que se pueda???
les pongo una parte del código:
$archivo = $_POST["archivo"];
$nombrearchivo = $_POST["nombrearchivo"];
$to = [email protected];
$subject = "Arhivo $serie";
$random_hash = md5(date('r', time()));
$headers = "From: Yo <[email protected]>\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "CC: [email protected]\r\n";
$headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-".$random_hash."\"";
$attachment = chunk_split(base64_encode(file_get_contents($archi vo)));
ob_start(); //Turn on output buffering
?>
--PHP-mixed-<?php echo $random_hash; ?>
Content-Type: multipart/alternative; boundary="PHP-alt-<?php echo $random_hash; ?>"
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
ARCHIVO NO. <?php echo $serie; ?>
Detalle: <?php echo $detalle; ?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<div align='center'>
... resto del código HTML...
--PHP-alt-<?php echo $random_hash; ?>--
--PHP-mixed-<?php echo $random_hash; ?>
//Content-Type: application/zip; name=<?php echo $archivo; ?>.zip
Content-Type: application/zip; name=<?php echo $nombrearchivo; ?>.zip
Content-Transfer-Encoding: base64
Content-Disposition: attachment
<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--
<?php
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>