Minggu, 22 April 2018

PHP
Kirim attachment banyak / Multiple file dengan php
9 October 2009 00:00
Setelah membuat script Untuk kirim Attachment dengan 1 file, lalu bagaimana jika kita akan

mengirim email dengan banyak/ Multiple file.
Berikut script yang dibuat hanya ada beberapa yang perlu di ubah :

 

<?
$adminEmail = "$_POST[adminEmail]";
              
if($_POST['submit']) {
                    
    $to = $_POST['to'];
    $subject = $_POST['subject'];                          
                    
    $pengantar=$_POST[pengantar];
                                        
    $pengantarok =

"Dear&nbsp;&nbsp;".ucfirst(strtolower($_POST['Salutation']))."".ucfirst(strtolower($_POST['Suren

ame'])).",<br><br>";
    $pengantarok2 = "$pengantar<br><br>";
    $pesan = "<table width=700 border=0 cellpadding=0 cellspacing=0 align=center>
        <tr><td height='10'></td></tr>
        <tr><td>$pengantarok</td></tr><tr><td>$pengantarok2</td></tr><tr><td>
    <table width=700 border=0 cellspacing=0 cellpadding=0>
    <tr>
      <td height=25></td>
    </tr>
    </table>
    </td></tr></table>";    
                    
    $attach      = $_FILES['file1']['tmp_name'];
      $attach_type = $_FILES['file1']['type'];
      $attach_name = $_FILES['file1']['name'];

    $countattach = count($attach);
    
      $headers = "From: $adminEmail";


    // Generate string untuk batas (boundary)
    $semi_rand     = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
          
    // Tambahkan header untuk file yang akan dikirim
    $headers .= " MIME-Version: 1.0 " .
          "Content-Type: multipart/mixed; " .
          " boundary="{$mime_boundary}"";
        
    // Tambahkan pesan
    $message .= "--{$mime_boundary} " .
             "Content-Type: text/html; charset="iso-8859-1" " .
             "Content-Transfer-Encoding: 7bit " .
             $pesan . " ";
    $message .= "--{$mime_boundary} ";
                    
    for($i=0;$i<count($attach);$i++){

     // Apabila ada file yang di attach    
    if (is_uploaded_file($attach[$i])) {    
        // Baca file yang akan di attach/kirim ('rb' = read binary)
    $file = fopen($attach[$i],'rb');
    $data = fread($file,filesize($attach[$i]));
    fclose($file);
                    
    // Untuk transisi data gunakan base64_encode();
    $data = chunk_split(base64_encode($data));
                
    // Tambahkan pesan pada file yang dikirim.
    $message .= "Content-Type: {$attach_type[$i]}; " . " name="$attach_name[$i]" " .
        
    "Content-Transfer-Encoding: base64 " . $data . " ";
            
    $message .= "--{$mime_boundary} ";    
                    
    }        
            
    }
 
$body = "$message";
                    
mail($to, $subject, $body, $headers);
                  
echo '<b>Your mail had been send to '.$to.' recipients</b>';


} else {

?>                    
      <form name="letter" action="" method="post" enctype="multipart/form-data">
      <table width="100%"  border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td width="23%">Salutation</td>
            <td width="77%"><font size="2" face="Verdana, Arial, Helvetica,

sans-serif"><input type="radio" name="Salutation" value="Mr.">Mr.&nbsp;<input type="radio"

name="Salutation" value="Mrs.">Mrs.</font></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td width="23%">Name To</td>
            <td width="77%"><input name="Surename" type="text" id="Surename" size="35"

style="font-weight:bold" onFocus="this.value='';" value="isi sure name"></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td width="23%">Email To</td>
            <td width="77%"><input name="to" type="text" id="to" size="35"

style="font-weight:bold" onFocus="this.value='';" value="isi to"></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>Subject</td>
            <td>
            <input name="subject" type="text" id="subject" size="60"

style="font-weight:bold" value=""></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>From Email</td>
            <td>
            <input name="adminEmail" type="text" id="adminEmail" size="60"

style="font-weight:bold" value=""></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr>
            <td>Pengantar Kata</td>
            <td><textarea name="pengantar" id="pengantar" rows="15" cols="80"

style="width:50%"></textarea></td>
          </tr>
          <tr><td colspan="2" height="10"></td></tr>
          <tr><td colspan="2" height="10"></td></tr>
        <? for($f=0;$f<20;$f++){ ?>
          <tr>
            <td>Attach File</td>
            <td><input type="file" name="file1[]"></td>
          </tr>
        <? } ?>
          <tr><td colspan="2" height="10"></td></tr>
              <tr>
                <td colspan="2"><input type="submit" name="submit" value="Send Mail"></td>
              </tr>
            </table>
          </form>
<? } ?>


Share |


Stevenscoug, yourmail@gmail.com
22/04/2018 11:04:28
http://viagra19.com - buy viagra [url=http://viagra19.com]buy viagra[/url] buy viagra http://cialis19.com - buy cialis [url=http://cialis19.com]buy cialis[/url] buy cialis http://cialiskkk.com - cialis dosage recommendations [url=http://cialiskkk.com]cialis great britain[/url] cialis para que sirve http://viagrarpr.com - viagra generic availability [url=http://viagrarpr.com]does viagra work[/url] viagra cheap http://link.me.rs/?http://buyvviagra.com
Petergoaph, Drerritili@gmail.com
22/04/2018 11:04:24
http://levitrarrr.com - levitra for women [url=http://levitrarrr.com]free levitra[/url] levitra canada http://viagrarrr.com - viagra dosage [url=http://viagrarrr.com]viagra générique[/url] viagra uk http://cialisrrr.com - generic cialis tadalafil [url=http://cialisrrr.com]viagra or cialis[/url] cialis 200 dollar savings card http://viagrarpr.com - lowest price on viagra [url=http://viagrarpr.com]order viagra[/url] viagra sex http://lafashions.com/__media__/js/netsoltrademark.php?d=buyccialis.com
Chungbroda, Drerritili@gmail.com
22/04/2018 11:04:23
http://cialis19.com - cialis [url=http://cialis19.com]cialis[/url] cialis http://viagra19.com - viagra [url=http://viagra19.com]viagra[/url] viagra http://cialisvvr.com - cialis rezeptfrei [url=http://cialisvvr.com]cialis 20mg prix en pharmacie[/url] cialis 20mg http://viagravvr.com - generic viagra prices [url=http://viagravvr.com]generic viagra prices[/url] viagra receptfritt http://onestepsurety.biz/__media__/js/netsoltrademark.php?d=viagrarpr.com
order cialis online, mihkakakeseeosi@gmail.com
22/04/2018 11:04:01
cialis buy cialis online generic cialis online tadalafil cialis online [url=https://genericcialisonline2018.com/]tadalafil[/url] buy cialis
advanced-background-checks stream, advanced-background-checks.stream@gmail.com
22/04/2018 10:04:40
Tampa police department records phone number, http://advanced-background-checks.stream free public marriage records in alabama.
order cialis online, mihkakakeseeosi@gmail.com
22/04/2018 10:04:07
order cialis online buy cialis online generic cialis tadalafil buy cialis [url=https://genericcialisonline2018.com/]tadalafil[/url] order cialis online
Petergoaph, Drerritili@gmail.com
22/04/2018 09:04:53
http://levitrarrr.com - staxyn vs levitra [url=http://levitrarrr.com]levitra price[/url] levitra 10mg http://viagrarrr.com - viagra generic availability [url=http://viagrarrr.com]viagra on line[/url] canadian viagra http://cialisrrr.com - cialis sans ordonnance [url=http://cialisrrr.com]discount cialis[/url] cialis 20 mg best price http://viagrarpr.com - generic viagra available [url=http://viagrarpr.com]viagra bestellen[/url] viagra side effects http://www.childpsy.ru/bitrix/redirect.php?event1=&event2=&event3=&goto=http://buyccialis.com
Chungbroda, Drerritili@gmail.com
22/04/2018 09:04:52
http://cialis19.com - cialis [url=http://cialis19.com]cialis[/url] cialis http://viagra19.com - viagra [url=http://viagra19.com]viagra[/url] viagra http://cialisvvr.com - cialis [url=http://cialisvvr.com]cialis official site[/url] cialis alternative http://viagravvr.com - buy viagra online [url=http://viagravvr.com]viagra en ligne livraison 24h[/url] viagra generic http://bathroomdetailing.net/__media__/js/netsoltrademark.php?d=viagrarpr.com
Stevenscoug, yourmail@gmail.com
22/04/2018 09:04:42
http://viagra19.com - buy viagra [url=http://viagra19.com]buy viagra[/url] buy viagra http://cialis19.com - buy cialis [url=http://cialis19.com]buy cialis[/url] buy cialis http://cialiskkk.com - cialis generic [url=http://cialiskkk.com]purchasing cialis on the internet[/url] buy cialis online http://viagrarpr.com - viagra rezeptfrei цsterreich [url=http://viagrarpr.com]viagra samples[/url] viagra sans ordonnance http://htmlhelp.com/cgi-bin/validate.cgi?url=http://buyvviagra.com
Stevenscoug, yourmail@gmail.com
22/04/2018 08:04:13
http://viagra19.com - buy viagra [url=http://viagra19.com]buy viagra[/url] buy viagra http://cialis19.com - buy cialis [url=http://cialis19.com]buy cialis[/url] buy cialis http://cialiskkk.com - cialis 20mg prix en pharmacie [url=http://cialiskkk.com]buy cialis[/url] cialis http://viagrarpr.com - female viagra [url=http://viagrarpr.com]viagra genйrico[/url] viagra official site http://anadigics.de/__media__/js/netsoltrademark.php?d=buyvviagra.com
buy cialis online, ammaamuelTum@gmail.com
22/04/2018 08:04:10
Buy Cheap Cialis Buy Cheap Cialis [url=https://cialiszxc.com/#]buy cialis online[/url] https://cialiszxc.com/ - cheap cialis cialis canada cialis [url=http://buycialiszsx.com/Tadalafil.html]Tadalafil[/url] [url=http://cialisforyou.com/Cialis-40-mg-generic.html]Cialis 40 mg generic[/url] [url=http://buycialisgenericzs.com/Cialis-for-sale.html]Cialis for sale[/url] [url=http://cialisworld.com/Tadalafil-without-a-doctors-prescription.html]Tadalafil without a doctor`s prescription[/url] [url=http://buycialisgenericzs.com/Cialis-30-day-trial-coupon.html]Cialis 30 day trial coupon[/url]
Chungbroda, Drerritili@gmail.com
22/04/2018 08:04:06
http://cialis19.com - cialis [url=http://cialis19.com]cialis[/url] cialis http://viagra19.com - viagra [url=http://viagra19.com]viagra[/url] viagra http://cialisvvr.com - cialis 20 mg best price [url=http://cialisvvr.com]cialis from canada[/url] viagra cialis levitra http://viagravvr.com - generic viagra 100mg [url=http://viagravvr.com]how to use viagra[/url] viagra official site http://usavacationcenters.com/__media__/js/netsoltrademark.php?d=viagrarpr.com
Petergoaph, Drerritili@gmail.com
22/04/2018 08:04:06
http://levitrarrr.com - levitra dose [url=http://levitrarrr.com]viagara cialis levitra[/url] levitra or viagra http://viagrarrr.com - viagra en ligne livraison 24h [url=http://viagrarrr.com]viagra dosage[/url] free viagra http://cialisrrr.com - cialis for sale [url=http://cialisrrr.com]cialis for bph[/url] cialis canada http://viagrarpr.com - viagra ohne rezept aus deutschland [url=http://viagrarpr.com]viagra genérico[/url] what does viagra do http://www.appraisalking.net/__media__/js/netsoltrademark.php?d=buyccialis.com
cheap cialis, ammaamuelTum@gmail.com
22/04/2018 07:04:20
cialis cialis [url=https://cialiszxc.com/#]cialis online[/url] https://cialiszxc.com/ - buy cialis online cialis online cialis canada [url=http://buycialiszsx.com/Cialis-manufacturer-coupon.html]Cialis manufacturer coupon[/url] [url=http://buyrealcialisonline.com/Cialis-from-canada.html]Cialis from canada[/url] [url=http://buycialisgenericzs.com/5-Mg-cialis-coupon-printable.html]5 Mg cialis coupon printable[/url] [url=http://buycialisgenericzs.com/Generic-tadalafil-5-mg.html]Generic tadalafil 5 mg[/url] [url=http://buycialisgenericzs.com/Tadalafil-20-mg-rezeptfrei-bestellen.html]Tadalafil 20 mg rezeptfrei bestellen[/url]
checks background, affordable-background-checks.stream@gmail.com
22/04/2018 06:04:40
Criminal background search free, http://affordable-background-checks.stream injuring public records louisiana code.
Petergoaph, Drerritili@gmail.com
22/04/2018 06:04:14
http://levitrarrr.com - canadian pharmacy levitra [url=http://levitrarrr.com]levitra side effects[/url] buy generic levitra online http://viagrarrr.com - generic viagra 100mg [url=http://viagrarrr.com]vad kostar viagra[/url] viagra canada http://cialisrrr.com - cialis vs viagra [url=http://cialisrrr.com]cialis generico in farmacia[/url] cialis dosage http://viagrarpr.com - viagra tablet [url=http://viagrarpr.com]taking viagra[/url] viagra australia http://vesiletunnecat.com/forum/url.asp?url=http://buyccialis.com
Chungbroda, Drerritili@gmail.com
22/04/2018 06:04:14
http://cialis19.com - cialis [url=http://cialis19.com]cialis[/url] cialis http://viagra19.com - viagra [url=http://viagra19.com]viagra[/url] viagra http://cialisvvr.com - 5 mg cialis coupon printable [url=http://cialisvvr.com]cialis from canada[/url] cialis pills http://viagravvr.com - viagra rezeptfrei osterreich [url=http://viagravvr.com]viagra rezeptfrei osterreich[/url] cheap viagra http://www.aafa.org/themes/kfa-new-theme/include/feed2js/feed2js.php?src=http://viagrarpr.com
Stevenscoug, yourmail@gmail.com
22/04/2018 06:04:03
http://viagra19.com - buy viagra [url=http://viagra19.com]buy viagra[/url] buy viagra http://cialis19.com - buy cialis [url=http://cialis19.com]buy cialis[/url] buy cialis http://cialiskkk.com - cialis without a doctor`s prescription [url=http://cialiskkk.com]purchasing cialis on the internet[/url] cialis canada http://viagrarpr.com - generic viagra from amazon [url=http://viagrarpr.com]viagra gйnйrique[/url] viagra on line no prec http://www.deploynow.com/__media__/js/netsoltrademark.php?d=buyvviagra.com
cialis online, mihkakakeseeosi@gmail.com
22/04/2018 05:04:52
cialis cheap buy cialis online order cialis online tadalafil cialis [url=https://genericcialisonline2018.com/]tadalafil[/url] generic cialis online
Stevenscoug, yourmail@gmail.com
22/04/2018 05:04:38
http://viagra19.com - buy viagra [url=http://viagra19.com]buy viagra[/url] buy viagra http://cialis19.com - buy cialis [url=http://cialis19.com]buy cialis[/url] buy cialis http://cialiskkk.com - cialis 5 mg [url=http://cialiskkk.com]cialis side effects[/url] cialis generika in deutschland kaufen http://viagrarpr.com - viagra 100mg [url=http://viagrarpr.com]viagra generic availability[/url] viagra natural http://note-art.com/__media__/js/netsoltrademark.php?d=buyvviagra.com

Add Your Comment
Name
Email Address
Website / URL
Message
Mak [600] Karakter
Verify code


copyright © 2004 - 2013 All Rights Reserved, Web Development