📕
Sprnva Docs
  • Introduction
  • What's New?
  • Installation
    • Requirements
    • Download Sprnva zip no composer required
    • Install Sprnva Using Composer
    • Setup Config
  • Deployment
  • File Structure
  • Database
    • Select
    • SelectLoop
    • Insert
    • Update
    • Delete
    • Query
    • Seeder
    • Paginate
    • With
    • andFilter
    • withCount
    • get
  • Query Builder
  • Migration
    • INSTANCES
      • NEW
      • RENAMETABLE
      • DROP
      • CHANGE
    • DUMPS
      • dump
      • dump prune
    • MAKE
    • MIGRATE
      • migrate
      • migrate fresh
    • ROLLBACK
  • Routing
    • with parameter
    • multiple parameters
    • with closure
    • group
    • controller grouping
  • Controllers
    • methods
  • Views
    • Passing Parameters
  • Validation
    • validate
      • validation type
  • Authentication
  • Alert Messages
  • Default Helpers
  • CSRF Protection
  • Email
  • Packages
    • Fortify
  • Themes and Templates
Powered by GitBook
On this page

Email

Sprnva has a built in email helper function powered by PHPMailer.

PreviousCSRF ProtectionNextPackages

Last updated 2 years ago

In order to send mail from your local computer you need to configure your apache's php.ini. Uncomment the extension=php_openssl.dll and restart your apache.

Then configure your gmail account to act like our email server and turn on less secure apps access.

Configure smtp credentials on config.php

// EMAIL
'smtp_host' => '',
'smtp_username' => '',
'smtp_password' => '',
'smtp_auth' => true,
'smtp_auto_tls' => true,
'smtp_port' => 25

As for the smtp_host you can use smtp.gmail.com and for the smtp_username use your gmail account email address also your gmail account password as smtp_password and the smtp_port is best with 587.

Then the email helper function look like this:

sendMail($subject, $body, $recipients);

Where $subject is string, $body is text or html, $recipients string email of the recipient.

The sendMail() helper return an array with 2 values.

["message" => "Message has been sent"]