Skip to content

A PHP class to send emails individually to a list of addresses

Notifications You must be signed in to change notification settings

nottrobin/PHP-Mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

PHP Mailer

This is a simple PHP class for sending emails individually to multiple recipients in PHP.

The Mailer class can also add the greeting for you, in the form "Dear [Name]".

To use it simply edit sendEmails.php - it's pretty self explanatory:

require_once('Mailer.php');

// Message config
$fromAddr    = '"Joe Bloggs" <joe@example.com>'; // OR simply 'joe@example.com'
$subject     = 'An email about something';
$message     = 'Guess what? I just sent you an email!'; //  OR file_get_contents('message.txt')
$addGreeting = true; // Whether to add a 'Dear ...,' line to the top of the email
$recipients  = array(
    'joe@example.com', // This will appear 'Dear Sir/Madam,' (if $addGreeting == true)
    'Joe' => 'joe@example.com', // This will appear 'Dear Joe,'
);

// Set the mailer going
$mailer = new Mailer($message, $recipients, $subject, $fromAddr, $addGreeting);
$mailer->sendAll();

Then to actually send the email just run the following from a command prompt at the root of the project:

./sendEmails.php

The script will output its progress to the command prompt (or whatever STDOUT defaults to).

About

A PHP class to send emails individually to a list of addresses

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages