Queue, preview and and send emails stored in the database.

Overview

Codeigniter4 email queue

Queue, preview and and send emails stored in the database.

This package provides an interface for creating emails on the fly and store them in a queue to be processed later by an offline worker using a Codeigniter4 CLI command.

Requirements

  • Codeigniter 4.x
  • codeigniter4/settings

Installation

composer require kgrruz/codeigniter4-email-queue

run migrations command:

php spark migrate -n EmailQueue

Usage

You must set these configuration values using the codeigniter4/settings package before using it:

    setting('Email.fromEmail')
    setting('Email.fromName')
    setting('Email.protocol')

In case of SMTP protocol:

    setting('Email.SMTPHost')
    setting('Email.SMTPPort')
    setting('Email.SMTPUser')
    setting('Email.SMTPPass')
    setting('Email.SMTPCrypto')
    setting('Email.SMTPTimeout')
    setting('Email.SMTPKeepAlive')

Default email settings:

    $config['mailpath'] = '/usr/sbin/sendmail';
    $config['wordWrap'] = true;
    $config['mailType'] = 'html';

Whenever you need to send an email, use the EmailQueue model to create and queue a new one by storing the correct data:

use EmailQueue\EmailQueue;
EmailQueue::enqueue($to, $subject, $data);

enqueue method receives 3 arguments:

  • First argument is a string of email addresses that will be treated as recipients.
  • Second argument is an string with the email subject
  • Third arguments is an array of view variables to be passed to the email template
  • message: Email's body text/html

Sending emails

Emails should be sent using bundled Sender command, use -l option to limit the number of emails processed

# php spark emails:send -l 10

You can configure this command to be run under a cron or any other tool you wish to use.

Todo

  • Attachments
  • Priority
  • BCC,CC

Contributing

Run the tests

./vendor/bin/phpunit tests/
You might also like...
 Mail Web is a Laravel package which catches emails locally for debugging
Mail Web is a Laravel package which catches emails locally for debugging

Mail Web is a Laravel package which catches emails locally for debugging Installation Use the package manager composer to install Mail Web. composer r

This application (class) does the sending of emails used in the phpmailer library

emailsender - PHP Notification library via email using phpMailer This library has the function of sending email using the phpmailer library. Doing thi

Send email across all platforms using one interface

Send email across all platforms using one interface. Table Of Content Requirements Installation Providers AmazonSES Mailgun Mailjet Mandrill Postmark

SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services

SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services

A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address
A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address

A Laravel package to check if you can send e-mail through a given mailserver in name of a given e-mail address Mail spf checker A Laravel package to c

Mail Api for fetch or send mails

flux-mail-api Mail Api for fetch or send mails Installation Native Download RUN (mkdir -p /%path%/libs/flux-mail-api && cd /%path%/libs/flux-mail-api

Cross-language email validation. Backed by a database of over 38 000 throwable email domains.
Cross-language email validation. Backed by a database of over 38 000 throwable email domains.

Cross-language temporary (disposable/throwaway) email detection library. Covers 38038+ fake email providers.

Mail sending module for Mezzio and Laminas MVC with support for file attachment and template email composition
Mail sending module for Mezzio and Laminas MVC with support for file attachment and template email composition

This module provides an easy and flexible way to send emails from Mezzio and Laminas MVC applications (formerly known as Zend Expressive and Zend MVC). It allows you to pre-configure emails and transports, and then send those emails at runtime.

Fetch is a library for reading email and attachments, primarily using the POP and IMAP protocols

Fetch Fetch is a library for reading email and attachments, primarily using the POP and IMAP protocols. Installing N.b. A note on Ubuntu 14.04 (probab

Owner
null
A mail driver to quickly preview mail

A mail driver to quickly preview mail This package can display a small overlay whenever a mail is sent. The overlay contains a link to the mail that w

Spatie 1k Jan 4, 2023
Laravel mailer which will catch all the sent emails and show them on an application view.

Laravel Web Mailer This package contains a web mailer which will catch all the sent emails. Then, you can view it visiting the route /web-inbox. The e

Creagia 54 Dec 16, 2022
A ready-to-use PHP script for sending Emails with an HTML Template will use a Gmail account as the sender and you will not need any email server. Powered by PHPMailer.

Gmail Email Sender by PHP A ready-to-use PHP script for sending Emails with an HTML Template will use a Gmail account as the sender and you will not n

Max Base 4 Oct 29, 2022
CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.

CssToInlineStyles class Installation CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline style

Tijs Verkoyen 5.7k Dec 29, 2022
Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)

PHP IMAP Initially released in December 2012, the PHP IMAP Mailbox is a powerful and open source library to connect to a mailbox by POP3, IMAP and NNT

Sergey 1.5k Jan 3, 2023
The Mailer component helps sending emails

Mailer Component The Mailer component helps sending emails. Getting Started $ composer require symfony/mailer use Symfony\Component\Mailer\Transport;

Symfony 1.1k Jan 7, 2023
Allows you to archive old emails from one Gmail mailbox to another Gmail mailbox

Gmail Archiver L'application Gmail archiver permet de déplacer automatiquement tous les vieux mails d'une boite Gmail vers une autre boite Gmail (ou é

Arnaud Lemercier 19 Jan 27, 2022
Offer an online version of your Laravel emails to users.

This is was a collaborative project with Ryan Chandler. Please consider supporting him for the hard work he put into this package! Help support the ma

Sam Carré 251 Dec 25, 2022
An AngularJS / Laravel app - Keyword Based Email forwarder | read/write emails through IMAP

@MailTree Simple mail forwarder. Based on the specific email body/subject keywords forward mails to the list of predefined users. Install Imap Install

Dren Kajmakchi 4 Aug 21, 2018
Store outgoing emails in Laravel

Record and view all sent emails Watch a video walkthrough https://www.youtube.com/watch?v=Oj_OF5n4l4k&feature=youtu.be Documentation and install instr

David Carr 203 Dec 15, 2022