-
Notifications
You must be signed in to change notification settings - Fork 0
berry.email.SMTPEMail
Nikos Siatras edited this page Oct 16, 2024
·
2 revisions
public function __construct()
SMTPEMail class represents a simple e-mail message that will be sent out using an SMTP Server
require_once(__DIR__ . "/berry/email.php"); // Include berry email package
$htmlContent = '<html>';
$htmlContent .= '<body>';
$htmlContent .= '<h1>Email Title</h1>';
$htmlContent .= '<div>Dear customer, this is the server's administrator...</div>';
$htmlContent .= '</body>';
$htmlContent .= '</html>';
$mail = new SMTPEMail("localhost", 25, "email@domain.com", "password", "");
$mail->setFrom("admin@domain.com", "Server Administrator");
$mail->addTo("client@otherdomain.com");
$mail->setSubject("Email Subject");
$mail->setHtmlMessage($htmlContent);
// Send the email
if ($email->Send())
{
print "Email sent!";
}
else
{
print "Unable to send the email!";
}
require_once(__DIR__ . "/berry/email.php"); // Include berry email package
$htmlContent = '<html>';
$htmlContent .= '<body>';
$htmlContent .= '<h1>Email Title</h1>';
$htmlContent .= '<div>Dear customer, this is the server's administrator...</div>';
$htmlContent .= '</body>';
$htmlContent .= '</html>';
$mail = new SMTPEMail("localhost", 587, "email@domain.com", "password", "tls");
$mail->setFrom("admin@domain.com", "Server Administrator");
$mail->addTo("client@otherdomain.com");
$mail->setSubject("Email Subject");
$mail->setHtmlMessage($htmlContent);
// Send the email
if ($email->Send())
{
print "Email sent!";
}
else
{
print "Unable to send the email!";
}