Skip to content

This is a simple SMTP PHPMailer. The PHP Class supports TLS, SSL and File Attachments in mail.

Notifications You must be signed in to change notification settings

s22-tech/PHP-SMTP-Mailer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP-SMTP-Mailer

This is a lightweight SMTP PHPMailer.
Updated to work with PHP 8.0.
The PHP Class supports TLS, SSL and File Attachments in mail.
Simple, powerful and easy to use.

Features:
  • Sends mail using one SMTP Server like 'smtp.gmail.com'.
  • Auth login with username and password.
  • Uses security protocols TLS and SSL.
  • Supports 'text/html' or 'text/plain' messages.
  • Supports any number of file attachments.
  • Default Charset is 'UTF-8' but can be changed.
  • 8bit, 7bit, Binary or Quoted-Printable transfer encoding.
  • Logging of the transaction for debug.
Email Headers:
  • From - one address
  • Reply-To - multiple possible
  • To - multiple possible
  • Cc - multiple possible
  • Bcc - multiple possible

Usage

Set your config variables in your calling script.
Here's a basic example:

<?php

require '/path/to/SMTPMailer.php';

$mail = new SMTPMailer;

$mail->SMTPHost = 'mail.server.com';
$mail->Username = '[email protected]';
$mail->Password = 'password';

$mail->setFrom('[email protected]');
$mail->addAddress('[email protected]');

$mail->Subject = 'Greetings';

$mail->bodyPlain = <<<"PLAIN"
	Hello!  This is a test.
	PLAIN;

$mail->bodyHTML = <<<"HTML"
	This is a test from {$mail->SMTPHost} on port {$mail->Port}
	<br>
	<b>Greetings!</b>
	HTML;

echo PHP_EOL;
if ($mail->Send()) { echo 'Mail was sent successfully!'. PHP_EOL; }
else               { echo 'Mail failure!!!'. PHP_EOL; }

?>

About

This is a simple SMTP PHPMailer. The PHP Class supports TLS, SSL and File Attachments in mail.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%