Originariamente inviato da bobo4141
Scusatemi ma ho notato anche un'altra cosa...
La mail arriva ma alla casella che inserisci nel form mentre io vorrei arrivasse ad una mail predefinita.
Come risolvo anche questo problema?
Beh per questo masta modificare così il codice:
Codice PHP:
<?
$attach=false;
/*
AL POSTO DI METTERE:
$to= $_REQUEST['fromemail'];
Che inserisce appunto come destinatario l'indirizzo preso dal post
BASTA METTERE:
$to = "mionome@mioindirizzo.ext";
*/
$to = "mionome@mioindirizzo.ext";
$subject="Email proveniente da ialt.it";
// Questo non so se è valido e sopratutto se è utile...
$from = $to."<".$to.">";
$message = stripslashes($_REQUEST['message']);
$message = UTF8_decode($message);
$mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";
$attach = $_REQUEST['attach'];
if ($attach) {
$tmp_name = $_FILES['Filedata']['tmp_name'];
$type = $_FILES['Filedata']['type'];
$name = $_FILES['Filedata']['name'];
if(is_uploaded_file($tmp_name)){
$message .= "\n\nIn allegato il file: $name";
$file = fopen($tmp_name,'rb');
$data = fread($file,filesize($tmp_name));
fclose($file);
$data = chunk_split(base64_encode($data));
$headers = "From: $from\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/mixed;\r\n" .
" boundary=\"{$mime_boundary}\"";
$message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$type};\n" .
" name=\"{$name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
if(mail($to, $subject, $message, $headers)){
echo "success=true";
}
}
} else {
$headers = "From: $from\r\n";
if(mail($to, $subject, $message, $headers)){
echo "success=true";
}
}
?>