Ciao!
Ho realizzato una form con dei campi e tramite questo
mi viene inviato il contenuto dei campi via e-mail a 2 indirizzi ma con qualche problema.Codice PHP:<?php
// L'INDIRIZZO DEL DESTINATARIO DELLA MAIL
$to = "email_destinatario";
$from = stripslashes($_REQUEST['fromname'])."<".stripslashes($_REQUEST['fromemail']).">";
/* Per inviare email in formato HTML, si deve impostare l'intestazione Content-type. */
$intestazioni = "MIME-Version: 1.0\r\n";
$intestazioni .= "Content-type: text/html; charset=iso-8859-1\r\n";
// IL SOGGETTO DELLA MAIL
$subject = "Modulo";
// COSTRUZIONE DEL CORPO DEL MESSAGGIO
$body = "Modulo:\n\n";
$body .= "Nome: " . trim(stripslashes($_POST["nome"])) . "\n";
$body .= "Cognome: " . trim(stripslashes($_POST["cognome"])) . "\n";
$body .= "E-mail: " . trim(stripslashes($_POST["email"])) . "\n";
$body .= "Oggetto: " . trim(stripslashes($_POST["oggetto"])) . "\n";
$body .= "Testo: " . trim(stripslashes($_POST["testo"])) . "\n";
// INTESTAZIONI SUPPLEMENTARI
$headers = "From: " . "Mittente" ." "."<"."indirizzo_mittente".">";
$headers = "Bcc: " . stripslashes($_REQUEST['nome']) ." ". stripslashes($_REQUEST['cognome'])."<".stripslashes($_REQUEST['email']).">";
// INVIO DELLA MAIL
if(@mail($to, $subject, $body, $headers, $intestazioni)) { // SE L'INOLTRO E' ANDATO A BUON FINE...
header("location: ...");
// echo "L'e-mail e' stata inoltrata con successo.";
} else {// ALTRIMENTI...
// echo "Si sono verificati dei problemi nell'invio della e-mail.";
header("location: ...");
}
?>
Attualmente l'e-mail principale è email_destinatario e quella fornita dall'utente viene utilizzata come Bcc per la seconda e-mail.
Quando l'e-mail arriva all'e-mail principale (email_destinatario) non compare From predefinito ma un indirizzo del server, invece con la seconda e-mail, la Bcc che mi arriva ma non riporta il From predefinito (ma un indirizzo del server) e come To riporta email_destinatario, vorrei invece che comparisse il From predefinito e come To l'e-mail fornita dall'utente.
Quindi:
- invio di 2 e-mail
- From predefinito uguale per entrambe le e-mail
- To e-mail fornita dall'utente
- Bcc e-mail predefinita
Come fare?

Rispondi quotando