Core Boxx – Mail Module

This is a simple mail module for Core Boxx – To help speed up and make sending emails a lot easier. Simply plug this one into Core Boxx, and it’s ready to use.

 

TABLE OF CONTENTS

Download & Notes Quick Reference

 

 

DOWNLOAD & NOTES

First, here are the download links and a quick “setup guide” for the impatient folks who don’t want to read through everything.

 

LICENSE & DOWNLOAD

Core Boxx is released under the MIT License. You are free to use it for personal and commercial projects, modify as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

Download Core Boxx Mail Module | GitHubSource Forge

 

INSTALLATION & REQUIREMENTS

  • Download and set up the “Main Core Boxx” if you have not already done so.
  • Enable and set the default EMAIL_FROM in lib/CORE-config.php.
  • Just unzip in your project folder.

 

 

QUICK REFERENCE

Let us now walk through some quick usage examples of the mail module.

 

A) BASIC USAGE

$_CORE->load("Mail");
echo $_CORE->Mail->send([
  "from" => "sys@site.com",
  "to" => "job@doe.com",
  "cc" => "joe@doe.com", // OPTIONAL
  "bcc" => "jon@doe.com", // OPTIONAL
  "subject" => "Test Email",
  "body" => "This is a <strong>TEST</strong> email",
  "attach" => "PATH/IMAGE.JPG" // OPTIONAL
]) ? "OK" : $_CORE->error ;

// TO, CC, BCC CAN ALSO BE AN ARRAY OF EMAIL
// "to" => ["jac@doe.com", "jan@doe.com", "jay@doe.com"]
// ATTACH CAN ALSO BE AN ARRAY OF FILES
// "attach" => ["FILE-1", "FILE-2"]

Yep, send() is all you need. The bare minimum is to specify the from, to, subject, and body.

 

 

B) EMAIL HTML TEMPLATES

template.php
<html><body>
  <h1>Welcome!</h1>
  <p>Thank you for joining <?=$name?>. Here is your discount code <?=$code?></p>
</body></html>
Use Template
$_CORE->Mail->send([
  "from" => "sys@site.com",
  "to" => "Jon@doe.com",
  "subject" => "Welcome",
  "template" => "template.php",
  "vars" => ["name"=>"Jon", "code"=>"123ABC"]
]);

Take note, if body and template exist at the same time, template will take precedence.

Leave a Comment

Your email address will not be published. Required fields are marked *