PHP mailer with multi-form support

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kind1one
    New Member
    • Apr 2007
    • 1

    PHP mailer with multi-form support

    I am green to PHP and trying to create outside PHP mailer for html form ,i found the script i need but I can't get it to upload more than one file ,since i do not know exactly where to place script request for file2-file10 as well as the exact line to place extension control and size limit ,SOS , any help would be aprishiated

    the mailer script:
    [code=php]<?php
    if (strpos($_SERVE R['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ||
    !strpos($_SERVE R['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
    die("Bad referer");
    $form_fields=ar ray_keys($HTTP_ POST_VARS);$tem p="Sender's IP Address: ".$_SERVER['REMOTE_ADDR']."\n";while($fi eld = array_pop($form _fields)){$temp .="$field: $HTTP_POST_VARS[$field]\n";}$to=$_PO ST['To'];$from=$_POST['Email'];$message=$temp ;$fileatt=$_FIL ES['File']['tmp_name'];$fileatt_type= $_FILES['File']['type'];$fileatt_name= $_FILES['File']['name'];$headers="From : $from";if(is_up loaded_file($fi leatt)){$file=f open($fileatt,' rb');$data=frea d($file,filesiz e($fileatt));fc lose($file);$se mi_rand=md5(tim e());$mime_boun dary="==Multipa rt_Boundary_x{$ semi_rand}x";$h eaders.="\nMIME-Version: 1.0\n"."Content-Type: multipart/mixed;\n"." boundary=\"{$mi me_boundary}\"" ;$message="This is a multi-part message in MIME format.\n\n"."--{$mime_boundary }\n"."Content-Type: text/plain;charset=\ "UTF-8\"\n"."Conte nt-Transfer-Encoding: 7bit\n\n".$mess age."\n\n";$dat a=chunk_split(b ase64_encode($d ata));$message. ="--{$mime_boundary }\n"."Content-Type: {$fileatt_type} ;\n"." name=\"{$fileat t_name}\"\n"."C ontent-Transfer-Encoding: base64\n\n".$da ta."\n\n"."--{$mime_boundary }--\n";}

    $ok=@mail($to," YOUR COMANY OR NAME Form-Mail Message",$messa ge,$headers);
    if(!$ok)header( "location:domai n goes here");

    ?>[/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]
    Last edited by pbmods; Jun 3 '07, 03:05 PM. Reason: Added code tags.
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Next time read the posting guidelines. and wrap the code using CODE tags.
    Last edited by pbmods; Jun 3 '07, 03:06 PM. Reason: Removed duplicated code. Made the change to the original post. Thanks!

    Comment

    • livemsn12
      New Member
      • Jun 2007
      • 2

      #3
      you can download php mailer and here

      Comment

      Working...