Andreas Haugstrup Pedersen wrote in
dk.edb.internet.webdesign.serverside.php:
> Thomas Dybdahl osv <1@3.be> wrote in news:b47vpi$d27$1@sunsite.dk:
>
> > Er det muligt at vedlægge filer i phps mail funktion?
>
> Ja, det er det da. Her er noget kode jeg brugte for noget tid siden. Du
> kan rette til som det passer dig.
Du må meget undskylde, men jeg er altså lidt af en noob til php. (begyndte
for få dage siden) Vil du ikke lave et mindre eksempel, noget i stil med:
mail("-@-.-",
"Overskridt",
"Tekst",
"file(url)",
"From: -@-.-\nReply-to: -@-.-");
på forhånd tak.
__Thomas
> $body = "Participate: $Participate\n
> Assistance: $assistance
> Company name: $Company_name
> Contact person: $Contact_person
> Telephone: $Telephone
> Fax: $Fax
> Website: $Website
> Person in charge: $Person_in_charge
> Direct tel. no. $Direct_tel_No
> Email: $Email
> Invite additional: $We_would_like_to_invite_additional
>
> Products:
> $Products
>
> Objectives:
> $Objectives
>
> Target groups:
> $Target_groups
>
> Background information:
> $Background_information_about_your_company\n\n";
>
>
> $to = $recipient;
> $redirect = "Location: $redirect";
> $errorpage = "Location: $errorpage";
> $from = $Email;
> $subject = "Feedback - Sri Lanka";
> $boundary = uniqid("");
> $headers = "From: $from\nMIME-Version:1.0\n";
>
> if ($HTTP_POST_FILES['userfile']['name'] != "") {
> $headers = "From: $from\nMIME-Version:1.0\nContent-type:
> multipart/mixed; boundary=\"$boundary\"";
> $mimeType = $HTTP_POST_FILES['userfile']['type'];
> $fileName = $HTTP_POST_FILES['userfile']['name'];
>
> $fp = fopen($HTTP_POST_FILES['userfile']['tmp_name'], "r");
> $read = fread($fp, filesize($HTTP_POST_FILES['userfile']['tmp_name']));
> $read = base64_encode($read);
> $read = chunk_split($read);
> $body = "--$boundary
> Content-type: text/plain; charset=\"ISO-8859-1\"
> Content-transfer-encoding: 8bit
>
> $body
>
> --$boundary
> Content-type: $mimeType; name=\"$fileName\"
> Content-disposition: attachment; filename=\"$fileName\"
> Content-transfer-encoding: base64
>
> $read
>
> --$boundary--";
> }
>
> if (mail($to, $subject, $body, $headers)) {
> header($redirect);
> exit;
> } else {
> header($errorpage);
> exit;
> }
>
>
> --
> Andreas
> <
http://www.solitude.dk>
--
Danmarks største specialiserede IT jobdatabase
- Udelukkende med IT- og internetrelaterede jobs
- Opret en profil og lad drømmejobbet finde dig
KLIK HER! =>
http://www.html.dk/job