Simcy Creative
  • What is Simcify
  • Requirements
  • Getting Started
  • Javascript Functions
    • Simple js Functions
    • Interaction Functions
      • Loader
      • Notifications
      • Credit Card Form
    • Helper Functions
      • Random
      • Cookies
      • Send to server(Ajax)
      • Server Responses
    • HTML helpers
      • Form Processing
      • Send onClick
      • Send onChange
      • Fetch & Display
      • Dropify
      • Switchery
      • Crop Image Input
      • Image Preview
  • PHP Functions
    • Introduction
    • Setup
    • Authentication
      • Login
      • Register
      • Forgot Password
      • Reset Password
    • Configuration
    • Email & SMS
      • SMS
        • Africa's Talking
        • Twilio
      • Email
    • Files Manager
      • Upload
      • Delete
Powered by GitBook
On this page
  • Parameters
  • Usage
  • Basic template
  • Template with button
  • Invoice Template
  1. PHP Functions
  2. Email & SMS

Email

This function allows you to send emails using SMTP and beautifully designed email templates.

To get started you need to ensure that you have setup the email variables on your .env file. Also you have a logo on your /uploads/app/ folder that will also the set on the .env file as APP_LOGO variable.

Check out more on env here;

Parameters

Parameter

Required

Type

Description

$to

Yes

string

Email of the recipient.

$subject

Yes

string

Subject of the email

$view_data

Yes

array

Array of data to print on the template. The structure of each template is explained below.

$view_name

No

string

The name of the template file in the /views/email/html folder without extension. e.g basic | withbutton | invoice

$from

No

string

Where the email is from e.g Simcy Creative <hello@simcycreative.com>

$attachements

No

array

array with full paths files to attach.

Usage

use Simcify\Mail;

Mail::send(
    "john@example.com",
    "Thank you for your purchase!"
    array(
        "message" => "Your order has been received and is being processed",
    ),
    "basic"
);

All $view_data values are required depending on the template.

Basic template

screenshot

Sample array

array(
    "message" => "Hello there, how are you?"
)

All array values are required.

Variable

Type

Description

message

string

The message to send on email.

Template with button

screenshot

Sample array

array(
    "title" => "Password reset",
    "subtitle" => "Click the button below to reset password",
    "buttonText" => "Reset Password",
    "buttonLink" => "https://example.com/reset"
    "message" => "Someone hopefully you asked for...."
)

All array values are required.

Variable

Type

Description

title

string

The title of the email

subtitle

string

The email subtitle

buttonText

string

The label of the button

buttonLink

string

The link of the button

message

string

The message to send on email.

Invoice Template

screenshot

Sample array

array(
    "title" => "Thank you for your purchase!",
    "subtitle" => "Your order has been received and is being processed",
    "summary" => array(
                    "currency" => "$",
                    "subtotal" => "243.6",
                    "tax" => "3.6",
                    "total" => "246.6",
                ),
    "items" => array(
                array(
                    "name" => "Socks",
                    "quantity" => "2",
                    "price" => "34.5",
                ),
                array(
                    "name" => "Green Bag",
                    "quantity" => "1",
                    "price" => "25.7",
                ),
                array(
                    "name" => "Sweat Pants",
                    "quantity" => "5",
                    "price" => "19.6",
                )
            )
)

All array values are required.

Variable

Type

Description

title

string

The title of the email

subtitle

string

The email subtitle

summary

array

This is an array containing: currency, subtotal, total & tax

items

array

This is an array of items with array of item details. Each array will have name, quantity & price

PreviousTwilioNextFiles Manager

Last updated 6 years ago