kirim_foeach.php
<?php
require_once("class.phpmailer.php");
$sendmail = new PHPMailer();
$sendmail->setFrom('cs@kandhang.com','Kandhang'); //email pengirim
$sendmail->addReplyTo('cs@kandhang.com','Admin Kandhang'); //email replay
$sendmail->addAddress('edi2992@gmail.com','Edi'); //email tujuan
$sendmail->Subject = 'Coba Email dengan PHPMailer'; //subjek email
$motor=array('king','supra','ninja');
foreach($motor as $index =>$isi){
$sendmail->Body=$index.". ".$isi; //isi pesan
}
$sendmail->isHTML(true);
if(!$sendmail->Send())
{
echo "Email gagal dikirim : " . $sendmail->ErrorInfo;
}
else
{
echo "Email berhasil terkirim!";
}
?>
------------------------------------------
<?php
session_start();
$tujuan="edi2992@gmail.com"; //dari email tujuan
$subject="Tes Email"; //judul email
$_SESSION['pesan']="Tes pengiriman ini dengan session ";
$pesan=$_SESSION['pesan']; //pesan
$dari="from : cs@kandhang.com";//joker@edi091.hol.es"; //email accunt anda
$kirim_email=mail($tujuan,$subject,$pesan,$dari); //fungsi untuk kirim email
if($kirim_email){
echo"email berhasil terkirim";
}else{
echo"email tidak terkirim";
}
?>
--------------------------------------------------------------
<?php
session_start();
mysql_connect('localhost','root','');
mysql_select_db('kandhang_siap');
$id=30;
$sql_select="select hewan_foto from tb_hewan where hewan_id='".$id."'";
$result=mysql_query($sql_select);
$data=mysql_fetch_array($result);
$body.="$data[hewan_foto]";
echo "ini body :".$body;
exit;
echo $data['hewan_foto'];
exit;
---------------------------------------------------------------------------
final.
<?php
$motor=array("mio","vario","klx");
$table_atas="<table border='1'>";
$header="<tr><td><b>No</b></td><td><b>Nama</b></td></tr>";
$table_bawah="</table>";
$no=0;
foreach($motor as $index => $isi){
$no++;
$kirim.="<tr><td>$no</td><td>$isi</td></tr>";
}
$hasil="$table_atas $header $kirim $table_bawah ";
echo $hasil;
?>
<?php
require_once("class.phpmailer.php");
$sendmail = new PHPMailer();
$sendmail->setFrom('cs@kandhang.com','Kandhang'); //email pengirim
$sendmail->addReplyTo('cs@kandhang.com','Admin Kandhang'); //email replay
$sendmail->addAddress('edi2992@gmail.com','Edi'); //email tujuan
$sendmail->Subject = 'Coba Email dengan PHPMailer'; //subjek email
$motor=array('king','supra','ninja');
foreach($motor as $index =>$isi){
$sendmail->Body=$index.". ".$isi; //isi pesan
}
$sendmail->isHTML(true);
if(!$sendmail->Send())
{
echo "Email gagal dikirim : " . $sendmail->ErrorInfo;
}
else
{
echo "Email berhasil terkirim!";
}
?>
------------------------------------------
<?php
session_start();
$tujuan="edi2992@gmail.com"; //dari email tujuan
$subject="Tes Email"; //judul email
$_SESSION['pesan']="Tes pengiriman ini dengan session ";
$pesan=$_SESSION['pesan']; //pesan
$dari="from : cs@kandhang.com";//joker@edi091.hol.es"; //email accunt anda
$kirim_email=mail($tujuan,$subject,$pesan,$dari); //fungsi untuk kirim email
if($kirim_email){
echo"email berhasil terkirim";
}else{
echo"email tidak terkirim";
}
?>
--------------------------------------------------------------
<?php
session_start();
mysql_connect('localhost','root','');
mysql_select_db('kandhang_siap');
$id=30;
$sql_select="select hewan_foto from tb_hewan where hewan_id='".$id."'";
$result=mysql_query($sql_select);
$data=mysql_fetch_array($result);
$body.="$data[hewan_foto]";
echo "ini body :".$body;
exit;
echo $data['hewan_foto'];
exit;
---------------------------------------------------------------------------
final.
<?php
$motor=array("mio","vario","klx");
$table_atas="<table border='1'>";
$header="<tr><td><b>No</b></td><td><b>Nama</b></td></tr>";
$table_bawah="</table>";
$no=0;
foreach($motor as $index => $isi){
$no++;
$kirim.="<tr><td>$no</td><td>$isi</td></tr>";
}
$hasil="$table_atas $header $kirim $table_bawah ";
echo $hasil;
?>
0 Response to "kirim email dengan PHP menggunakan Array"
Posting Komentar