Postingan lainnya
Mengirim kebanyak alamat email (phpmailer)
Assalamualikum, selamat malam mohon bantuan ilmunya.
<?php
error_reporting(E_ALL);
require 'PHPMailer/src/PHPMailer.php' ;
require 'PHPMailer/src/SMTP.php';
require 'PHPMailer/src/Exception.php';
$mail = new PHPMailer\PHPMailer1\PHPMailer();
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->SMTPAuth = true;
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPSecure = "tls";
$mail->Username = "blabla@gmail.com"; //username SMTP
$mail->Password = "blabla123"; //password SMTP
$mail->From = "blabla@gmail.com"; //sender email
$mail->FromName = "BLA BLA"; //sender name
$mail->AddAddress($_POST['email']);//recipient: email and name
$mail->Subject = $_POST['subjek'];
$mail->Body = "Bla Bla Bla";
$mail->AddAttachment("","filesaya");
if($mail->Send()){
echo "Email sent successfully";
}else{
echo "Email failed to send";
}
?>
Saya mengambil alamat email tujuan dari database dengan array ketika muncul bnyak alamat email di form input, hanya email terakhir yang terkirim mohon bantuannya .
Form Sent Mail
<tr class="text-center">
<td>Email :</td>
<td><input class="form-control form-control-sm" type="email" name="email" value="<?php echo $row['email']; ?>">
</td>
</tr>
0
3 Jawaban:
kalo kirim banyak email, bisa pake perulangan sesuai dengan data email yg mau dikirim
0
pake perulangan aja proses pengiriman emailnya, ntr alamat email tujuan diisi email yg dari database misalnya jadi kan ke loop sendmail nya. bisa pke event onsubmit misal
0