weboccult/eatcard-mail-companion

This package is create mail service for eatcard subsystem.

dev-master 2022-11-17 06:43 UTC

README

EatCard-Weboccult.png

Eatcard Mail Companion


Packagist PHP Version Support Latest Version on Packagist

GitHub Workflow Status (branch)

GitHub last commit GitHub Release Date

Total Downloads GitHub contributors GitHub

This companion package will help our team to manage to generic functionality and features at one place.

Installation

You can install the package via composer:

composer require weboccult/eatcard-mail-companion

Usage

use Weboccult\EatcardMailCompanion\Helpers\eatcardMailSend;

Available Services

  • Create Mail : To generate mail template based on requirements
  • Send Mail : To send mail via Laravel Queue/Jobs

Companion Config

here's how you can use publish companion config file to manage numerous settings

php artisan eatcardMailcompanion:publish --type=config

It will publish eatcardMailCompanion.php to your parent project

Basic Usage

Create Mail

  • Payload : user requirements
  • subject : Set mail subject
  • recipients : Recipients user email address
  • mailType : Type of mail (For developer)
  • fromName : Mail sender name
  • entityType : Type of mail (Where to get data)
  • entityId : Get data based on entityId
  • dispatch : Mail data dispatch in queue
  • template : Direct send mail template to user without details
  • bcc : Extra email addresses
  • cc : Extra email addresses
use Weboccult\EatcardMailCompanion\Helpers\eatcardMailSend;

eatcardMailSend()
    ->payload(['store_id' => $order['store_id'], 'recipient_type' => 'order.done'])
    ->subject(__('messages.takeaway_order_done_mail_sub') . ' ' . getDutchDate($order['order_date']))
    ->recipients($order['email'])
    ->bcc([])
    ->cc([])
    ->mailType('Order done mail from admin')
    ->fromName(env('MAIL_FROM_NAME'))
    ->template('Reservation create')
    ->entityType('order')
    ->entityId($order['id'])
    ->dispatch();

OR
use Weboccult\EatcardMailCompanion\EatcardMailCompanion;

EatcardMailCompanion::
    payload(['store_id' => $order['store_id'], 'recipient_type' => 'order.done'])
    ->subject(__('messages.takeaway_order_done_mail_sub') . ' ' . getDutchDate($order['order_date']))
    ->recipients($order['email'])
    ->bcc([])
    ->cc([])
    ->mailType('Order done mail from admin')
    ->fromName(env('MAIL_FROM_NAME'))
    ->template('Reservation create')
    ->entityType('order')
    ->entityId($order['id'])
    ->dispatch();
    

Send Mail

  • Mail send from jobs (SendMailJobs)
  • Create mail entry in mongoDb database after sending mail successfully to user
  • If something went wrong in mail sending part then data moved on failed jobs table