Tolong pilih kategori sesuai, jenis posting (diskusi atau bukan) dan sertakan tag/topik yang sesuai seperti komputer, java, php, mysql, dll. Promosi atau posting tidak pada tempatnya akan kami hapus!
- Bagi Anda yang ingin mendaftar, baca link berikut:
http://diskusiweb.com/discussion/50491/how-to-registrasi-diskusiweb-com-baca-ini-terlebih-dahulu
- Cara menyisipkan kode program supaya tampil rapi dan terformat dengan baik di diskusiweb.com: http://www.diskusiweb.com/discussion/50415/cara-menyisipkan-kode-program-di-diskusiweb-com
- Cara posting gambar/image di post Anda: http://www.diskusiweb.com/discussion/47345/cara-menyisipkan-menyertakan-image-pada-posting/p1

Tanya Send Multiple mail dari database

Agan sekalian ane mau minta tolong nih..

cara send multiple email dari database gimana ya??
ane bingung untuk loopingnya.. contoh scriptnya kaya gini<div class='geshi_syntax'><table><tr><td><div class='code'><pre class="php"><span class="kw2"><?php</span>
 
<span class="re0">$elist</span> <span class="sy0">=</span> <span class="kw3">mysql_query</span><span class="br0">(</span><span class="st0">"SELECT torder.*, product.*, member.* FROM `torder`, `product`, `member` WHERE torder.orderid='"</span><span class="sy0">.</span><span class="re0">$_SESSION</span><span class="br0">[</span><span class="st_h">'ORDERID'</span><span class="br0">]</span><span class="sy0">.</span><span class="st0">"' && torder.idproduct = product.idproduct && product.owner = member.login"</span><span class="br0">)</span><span class="sy0">;</span>
 
<span class="re0">$from</span> <span class="sy0">=</span> <span class="re0">$_SESSION</span><span class="br0">[</span><span class="st_h">'SET'</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'email'</span><span class="br0">]</span><span class="sy0">;</span>
<span class="re0">$subject</span> <span class="sy0">=</span> <span class="st0">"Order Product at "</span><span class="sy0">.</span><span class="kw3">UCFirst</span><span class="br0">(</span>domain<span class="br0">)</span><span class="sy0">.</span><span class="st0">""</span><span class="sy0">;</span>
<span class="re0">$html_message</span> <span class="sy0">=</span> <span class="st0">"<p>You have order at "</span><span class="sy0">.</span><span class="kw3">UCFirst</span><span class="br0">(</span>domain<span class="br0">)</span><span class="sy0">.</span><span class="st0">"<br /> Below are order details:<br />"</span><span class="sy0">;</span>
 
<span class="kw1">if</span><span class="br0">(</span><span class="kw3">mysql_num_rows</span><span class="br0">(</span><span class="re0">$elist</span><span class="br0">)</span> <span class="sy0">></span> <span class="nu0">0</span><span class="br0">)</span>
<span class="br0">{</span>
<span class="kw1">while</span><span class="br0">(</span><span class="re0">$elist_result</span> <span class="sy0">=</span> <span class="kw3">mysql_fetch_array</span><span class="br0">(</span><span class="re0">$elist</span><span class="br0">)</span><span class="br0">)</span>
<span class="br0">{</span>
 
<span class="re0">$headers</span> <span class="sy0">=</span> <span class="kw3">array</span> <span class="br0">(</span>
<span class="st_h">'email'</span> <span class="sy0">=></span><span class="re0">$elist_result</span><span class="br0">[</span><span class="st_h">'email'</span><span class="br0">]</span><span class="sy0">,</span>
<span class="st_h">'title'</span> <span class="sy0">=></span><span class="re0">$elist_result</span><span class="br0">[</span><span class="st_h">'title'</span><span class="br0">]</span><span class="sy0">,</span>
<span class="st_h">'subject'</span> <span class="sy0">=></span><span class="re0">$subject</span><span class="br0">)</span><span class="sy0">;</span>
 
 
<span class="kw1">if</span><span class="br0">(</span>ip<span class="sy0">!=</span><span class="st_h">''</span><span class="br0">)</span>
<span class="br0">{</span>
<span class="re0">$files</span><span class="sy0">=</span><span class="st_h">''</span><span class="sy0">;</span>
<span class="re0">$mail</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">sendmail</span><span class="br0">(</span><span class="re0">$files</span><span class="sy0">,</span> <span class="st_h">'Order '</span><span class="sy0">.</span><span class="kw3">UCFirst</span><span class="br0">(</span>domain<span class="br0">)</span><span class="sy0">,</span> <span class="re0">$_SESSION</span><span class="br0">[</span><span class="st_h">'SET'</span><span class="br0">]</span><span class="br0">[</span><span class="st_h">'email_admin'</span><span class="br0">]</span><span class="sy0">,</span> <span class="re0">$name</span><span class="sy0">,</span> <span class="re0">$headers</span><span class="br0">[</span><span class="st_h">'email'</span><span class="br0">]</span><span class="sy0">,</span> <span class="re0">$subject</span><span class="sy0">,</span> <span class="re0">$html_message</span><span class="sy0">.</span><span class="st_h">''</span><span class="sy0">.</span><span class="re0">$headers</span><span class="br0">[</span><span class="st_h">'title'</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span>
<span class="br0">}</span>
 
<span class="br0">}</span>
<span class="sy1">?></span></pre></div></td></tr></table></div>

nah saat script ane jalanin (misal send 3 email: email pertama dapet 3, email kedua dapet 2, dan email terakhir dapet 1)

mohon bantuannya gan supaya tiap email ya dapet 1 aja.. makasih sebelumnya...
Tagged:

Comments

  • edited November 2011
    ini maksudnya penerima pertama mendapatkan email yang sama tiga kali berturut-turut ya?
    coba variable email itu direset dulu setelah mengirim proses mengirim email. Return $this->sendmail() itu apa? boolean?
  • edited November 2011
    penerima pertama dapat 3 email berbeda, yang harusnya buat email kedua dan ketiga,
    penerima kedua dapat 2 email, yang harusnya buat email ketiga juga terkirim kesitu,
    kalo email ketiga udah bener cuma satu dapatnya..
    iya itu $this->sendmail() manggil fungsi send mail smtp.

    atau untuk lebih jelasnya saya tanya di kantor saja??
Sign In or Register to comment.