#1 function
mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]])
#2 example 01
<?
mail("admin@domainanda.com", "Hallo Dunia!", "Halo admin \n Apa
Kabar \n Anda hari ini?" , , "From: Web
<webmaster@domain-kirim.com>");
?>
#3 example 02
<?
$kepada = "admin@domainanda.com"; //email tujuan
$subject = "Hallo Dunia!"; //judul email
$pesan = "Halo admin \n Apa Kabar \n Anda hari ini?"; //pesan
$dari = "webmaster@domain-kirim.com"; //email account anda
$from = "From: $dari";
mail($kepada,$subject,$pesan,$from); //fungsi untuk kirim email
?>
#4 example 03 (using condition)
<?
if (mail("admin@domainanda.com", "Hallo Dunia!", "Halo admin \n Apa Kabar \n Anda hari ini?")) {
echo "Email sudah terkirim";
} else {
echo "Email gagal terkirim";
}
?>
#5 example 04 (advanced)
<?
if (mail("admin@domainanda.com", "Hallo Dunia!", "Halo admin \n
Apa Kabar \n Anda hari ini?", ,"From: Web
<webmaster@domain-kirim.com>""))
{
echo "Email sudah terkirim";
} else {
echo "Email gagal terkirim";
}
?>
"curiosity is motivation"
"letz share coz i only ask for information"
No comments:
Post a Comment