Tanya: Tambahkan Email di Script PHP ini Gimana ya?

Status
Not open for further replies.

iidbae

Expert 1.0
Om, om tanya dong.

Ada script PHP
Code:
/*------------------------------------
 * just replace email address with your email address
 ---------------------------------------------*/
$address = "misaliniemail@wmail.com";
Jadi mau nambahin alamat penerima lagi.
Itu kan cuman satu penerimanya, misaliniemail ET wmail .com.
Trus supaya bisa nambahin 2 penerima lagi gimana ya?

Apa harus begini?
Code:
/*------------------------------------
 * just replace email address with your email address
 ---------------------------------------------*/
$address = "misaliniemail@wmail.com";"emailkedua@wmail.com"; "emailkedua@wmail.com";
terima kasih
 

idnix

Hosting Guru
The Warrior
Verified Provider
source code asli nya gelar, ente nanya kayak gelas tanpa air
 

DraCoola

Expert 1.0
itu semicolon bertebaran bakal bikin error masgan
tjoba pake comma separator di dalem :
PHP:
$address = "misaliniemail@wmail.com, emailkedua@wmail.com, emailketiga@wmail.com";

ato bisa juga yg gondrong kek gini :
PHP:
$address = "misaliniemail@wmail.com" . ", ";
$address .= "emailkedua@wmail.com" . ", ";
$address .= "emailketiga@wmail.com";
 

el_makong

Hosting Guru
pertanyaan yang pertama muncul di kepala saya: "apakah script tersebut terima parameter email sebagai array atau text yang nantinya di explode"
untuk email sendiri bisa menggunakan kode berikut:
PHP:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
to

Receiver, or receivers of the mail.

The formatting of this string must comply with » RFC 2822. Some examples are:

  • user@example.com
  • user@example.com, anotheruser@example.com
  • User <user@example.com>
  • User <user@example.com>, Another User <anotheruser@example.com>
source: http://php.net/manual/en/function.mail.php
lagipula, kita gk bisa jawab secara presisi kalo script aslinya gk tercantum (minimal full function + trace)
 

DraCoola

Expert 1.0
update :

barusan saia tjoba pake fungsi mail() sederhana = mempan
baik comma separator ringkas mopun yg versi gondrong
PHP:
<?php
//printilannya
$subject = "tes kirim email";
$address = "misaliniemail@wmail.com, emailkedua@wmail.com, emailketiga@wmail.com";
$from = "terlalu@tampan.com";

//body email
$msg = "Pesan es teh";

//header
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=UTF-8\r\n";
$headers .= "From: <".$from. ">" ;

//berangkatken
mail($address,$subject,$msg,$headers);
echo "Email terkirim ^^";
?>

model di atas harusnja mempan juga buat smtp
kerna fungsi "$to" email di php ya memang bgitulah, baku dan klasik
sama dimana² standar penulisan multiple email penerima tjukup pake comma aja
 
Last edited:
Status
Not open for further replies.

    
Top