codice:$mess = " <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> <HTML> <HEAD> <META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\"> <STYLE> H5 {text-align: justify; text-decoration: none; color: #333333; font-size: 12px; font-family: Arial} A:link, A:visited, A:hover { color: #FFcc00 } </STYLE> </HEAD> <BODY bgColor=#ffffff link=#333333 alink=#333333 vlink=#333333> <DIV><h5>Questo è il corpo dell'email; si possono usare tutti i tag html, come se si trattasse di una pagina internet.</h5> </BODY> </HTML> "; $to = 'xxx@xxx.com'; /*Inserire l'indirizzo email a cui si vuole spedire l'email*/ $subject = 'Oggetto dell\'email'; /*Inserire l'oggetto dell'email da spedire*/ $from = 'xxx@xxx.com'; /*Inserire l'indirizzo email che verrà visulaizzato come mittente dell'email*/ $reply = 'xxx@xxx.com'; /*Inserire l'indirizzo email a cui verranno inviate le risposte all'email inviata*/ $title = 'prova.pdf'; /*Inserire il nome che si vuole dare all'allegato*/ $f = 'prova.pdf'; /*Inserire l'indirizzo del file che si vuole inviare come allegato*/ $filetype = 'application/pdf'; /*Inserire il formato MIME del file da allegare*/ /*Non modificare nulla al di sotto di questa linea*/ $headers = ''; $headers .= "To: $to\r\n"; $headers .= "From: $from\r\n"; $headers .= "Cc: xxx@xxx.it\r\n"; $headers .= "Bcc: xxx@xxx.it\r\n"; $headers .= "Reply-To: $reply\nX-Mailer: Sismail Web Email Interface\nMIME-version: 1.0\nContent-type: multipart/mixed;\n boundary=\"Message-Boundary\"\nContent-transfer-encoding: 7BIT\nX-attachments: $title"; $body_top = "--Message-Boundary\n"; $body_top .= "Content-type: text/html; charset=iso-8859-1\n"; $body_top .= "Content-transfer-encoding: 7BIT\n"; $body_top .= "Content-description: Mail message body\n\n"; $msg_body = $body_top . $mess; $filez = fopen($f, "r"); $contents = fread($filez, filesize($f)); $encoded_attach = chunk_split(base64_encode($contents)); fclose($filez); $msg_body .= "\n\n--Message-Boundary\n"; $msg_body .= "Content-type: $filetype; name=\"$title\"\n"; $msg_body .= "Content-Transfer-Encoding: BASE64\n"; $msg_body .= "Content-disposition: attachment; filename=\"$title\"\n\n"; $msg_body .= "$encoded_attach\n"; $msg_body .= "--Message-Boundary--\n"; $sent = mail($to,$subject,$msg_body,$headers); if ($sent) { echo 'OK'; } else { echo "Si sono verificati dei problemi durante l'invio del form; ESEGUIRE NUOVAMENTE LA PROCEDURA!"; }
r@p