<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
date_default_timezone_set("Asia/Jakarta");
require_once "vendor/autoload.php";
$mail = new PHPMailer;
$mail->From = "adiarray1@sarjanacode.com";
$mail->FromName = "Riadi Marta Dinata";
$mail->addAddress("adiarray2@sarjanacode.com", "Recepient Name");
$mail->addAddress("adiarray3@sarjanacode.com"); //Recipient name is optional
//Address to which recipient will reply
$mail->addReplyTo("adiarray1@sarjanacode.com", "Reply");
//CC and BCC
$mail->addCC("adiarray4@sarjanacode.com");
$mail->addBCC("humas@lp2maray.com");
//Send HTML or Plain Text email
$mail->isHTML(true);
$jam=date("H:i:s");
$mail->Subject = "Subject Text TEs I ".$jam;
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo."=".$jam;
}
else {
echo "Message has been sent successfully".$jam;
}
?>
Sent Attachment:
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
date_default_timezone_set("Asia/Jakarta");
require_once "vendor/autoload.php";
$mail = new PHPMailer;
$mail->From = "adiarray1@sarjanacode.com";
$mail->FromName = "Riadi Marta Dinata";
$mail->addAddress("adiarray2@sarjanacode.com", "Recepient Name");
$mail->addAddress("adiarray3@sarjanacode.com"); //Recipient name is optional
//Address to which recipient will reply
$mail->addReplyTo("adiarray1@sarjanacode.com", "Reply");
//CC and BCC
$mail->addCC("adiarray4@sarjanacode.com");
$mail->addBCC("humas@lp2maray.com");
$jam=date("H:i:s");
//Provide file path and name of the attachments
$mail->addAttachment("file.txt", "File.txt");
$mail->addAttachment("images/aray.jpg"); //Filename is optional
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>".$jam;
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo."=".$jam;
}
else
{
echo "Message has been sent successfully ".$jam;
}
?>
Download
Langganan:
Posting Komentar (Atom)
Selisih Waktu Berjalan
Berikut adalah fungsi PHP yang menghitung selisih hari antara tanggal saat ini dengan tanggal 2024-08-22 . Jika tanggal saat ini kurang dari...
-
<?php // <a href='download.php?file=$file' title='Download File'>Download Dokumen</a> $direktori = ...
-
Teman2 ...mungkin sering dapat kode random..... btw ini ada share sedikit ttg membuat soal random.....yang beda disini adalah sy menggunaka...
-
<?php $sql="select `id_admin` from `$tbadmin` order by `id_admin` desc"; $jum= getJum($conn,$sql); $kd="ADM"...
Tidak ada komentar:
Posting Komentar