Introduction

Before knowing exactly how to code things to make them work, a conceptual introduction is necessary before using any type of addon. That being said, understanding at a broad level how Mail Core works is important before considering how to specifically code it's functions.

What is Mail Core?

Mail Core, as said above is an FW Addon, whose goal is to more easily and consistently send emails in a streamlined fashion from the serverside of our apps. Any time an email is sent from one of the FW Apps, whether an automatic notification or as a specific message designed to be sent (as in Message Center), that app has used Mail Core.

How does it work, conceptually?

Mail Core heavily incorporates PHP Mailer. One of the main differences between PHP Mailer and Mail Core is that Mail Core incorporates a template system, where you can make a template php file, and plug variables in for easier sending experience. In addition to this, Mail Core also hides some of the complexities of PHP Mailer behind the scenes. Perhaps the most complexity is that Mail Core an email from the proper domain, so that emails have SPF and DMARC authentication, and will not be rejected as "spoofing."

To boil it down completely, Mail Core allows you to format an email in PHP (content, subject, recipients, replyTo, etc), and send it. It has some extra features to allow you to do this with more ease than just using plain PHPMailer.

Parts of this documentation

There are three main parts in dealing with this mail core addon. Each of them will be discussed separately:

  • Writing Send Email Function - This document discusses the various aspects of writing the actual function that sends the email, and gives some common functions that are used within most email sending.
  • Writing an Email Template - This discusses the various aspects of how to write a proper email template to use.
  • Calling an Email Function - This discusses the two primary ways in which an email function, after being written is properly called, and gives some examples.

At the end of each of these sections of code there is an integrated example to show you how you might code sending an actual email. The email is a very simple example of an email that an insurance company might send out if a car was totaled.

Note

All of this documentation is for after the breaking change of Mail Core 6.0, so if you are on an older version of Mail Core, please update Mail Core to 6.0.