Posted under » PHP » Linux on 1 May 2020
You can use phpmailer with SMTP. However, you can use your local postfix too.
< php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/phpmailer/phpmailer/src/Exception.php';
require 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
$isi = "<head><style>
body{
width:100% !important;
min-width: 100%;
-webkit-text-size-adjust:100%;
-ms-text-size-adjust:100%;
margin:0;
padding:0;
font-family: arial, sans-serif;
color: #444444;
font-size: smaller;
}
</style>
</head><body>
<p>You are kindly reminded that the deadline for PSY108 close on <b style='color:red;'>19 October 2025</b>, is (tomorrow).
<p>Best regards</p>
<p></body>";
$mail = new PHPMailer(true); // instantiate 1st
$mail->SetFrom('hanafi@aws.com', 'Vivian Baong');
//From email address and name
$mail->FromName = "Brad Pitt";
//To address and name
$mail->addAddress("aws@gmail.com", "Tommy Kock" );
//Send HTML or Plain Text email
$mail->isHTML(true);
$mail->Subject = "Final Reminder: Deadline";
$mail->Body = $isi;
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
?>