Laravel Mail Credentials switcher for Budget Laravel Applications

Overview

Laravel Mail Switcher

Build and Test codecov Latest Stable Version

Laravel Mail Credentials Switcher is a library which helps you to:

  • Manage your Mail Service Credentials
  • Configure the Laravel's Mail Driver and using the available credential
  • Switch to another credential if the previous one was out of usage of the current day/week/month
  • Automatically reset the usage (daily/weekly/monthly) of the credentials

Use-case

You have a personal Laravel Application (small or medium) or even you're a Startup. Of course, you have a tight budget.

So you probably can't spend much money for Email Provider Services to send out your email to your Users/Customers.

There are a lot of Email Provider Services out there that actually give you a specific amount per month (for free) to send out emails.

So, with Laravel Mail Switcher, you will have a big advantage to achieve that.

  • You don't have to change ENV everytime one of services is running out of usage.
  • You don't need to manually check to see if the email is running out.

All you need to do, is prepare the credential/information and let Laravel Mail Switcher will do that for you.

Email Services with Free Usage

  • Mailgun: 5000 emails for 3-month (about 1666/month)
  • Mailjet: 6000 emails per month (but 200 per day)
  • Sendgrid: 100 emails per day (3000/month)
  • Socketlabs: 2000/month (first month: 40000)
  • Sendinblue: 300 per day (9000/month)

And many more... With Laravel Mail Switcher, you can manage the credentials and use all of them until the free usage ran out!

Limitation

Laravel Mail Switcher is only support for SMTP driver at the moment.

Coming soon for others.

Requirement

  • Laravel 8.x
  • PHP 7.4

Installation

composer require sethsandaru/laravel-mail-switcher

How to use?

Laravel Mail Switcher doesn't need a GUI to work with. We will do all the stuff in Artisan Console.

First, you need to run the migration:

php artisan migrate

Then, you can traverse the instructions below!!

List All Emails

php artisan ms:list

Note: You can add --force to show all Credentials (even the exceeded usage credentials)

Add Email Credential

php artisan ms:add

You will see some questions that need your answers in order to add. Follow the instruction!!

Delete an Credential

php artisan ms:delete {credentialId}

Reset Threshold of expired Credentials

php artisan ms:reset

Like, your email credential is daily usage and exceeded yesterday. So, today we're gonna recover it to use it again.

Cronjob Setup

By default, I will let you configure the Cron Job / Task Scheduling in your Kernal.php

Best practice should be daily check at 00:00

$schedule->command('ms:reset')->dailyAt("00:00");

or every minute:

$schedule->command('ms:reset')->everyMinute();

Tech Specs / QA Times

Why did I choose to Overwrite the SMTP by listen to Mail's Events instead of ServiceProvider?

Because in real-life projects, not all the time, we will send out the emails. If I go with that way, then it probably costs 1 query everytime there is a connection to our application which isn't good and nice at all.

Improve this library?

Feel free to fork it and send me the PR, I'll happily review and merge it (if it's totally make sense of course).

Remember to write Unit Test also! Otherwise, I'll reject it.

Coding Style must follow PSR-1 & PSR-12.

Note

After your project is growing up, making good, then, don't forget to subscribe to an Email Service Provider for long-term supports and absolutely stable in production.

Copyright

2021 by Seth Phat

You might also like...
💌 Mail app for Nextcloud
💌 Mail app for Nextcloud

Nextcloud Mail 💌 A mail app for Nextcloud Why is this so awesome? 🚀 Integration with other Nextcloud apps! Currently Contacts, Calendar & Files – mo

Crud PHP 8 com Form E-mail
Crud PHP 8 com Form E-mail

Crud com PHP 8 PDO Login - Cadastro de Usuários - Edição - Deleção - Adição | Formulário envio de e-mail Para rodar o Crud é preciso instalar um servi

Simple mail sending by PHPMailer and Create your local system.

Simple mail sending by PHPMailer and Create your local system. Send mail zero of cost and also send Attachment like Photo, pdf and multiple files. You should be create a login and verify two steps authentication like OTP, verifications 🔗 link. PHPMailer make your dreams project eassy and simple also free of cost.

Mail application developed with Symfony 5

Fakey-Mail Mail application developed with Symfony 5! Check out the requirements for info on how to launch the app. Check out the basic functionality

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

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app. This enables your app to not only respond to new emails but also allows it to read and parse existing mails and much more.

MailEclipse - Laravel Mailable Editor!
MailEclipse - Laravel Mailable Editor!

MailEclipse is a mailable editor package for your Laravel applications to create and manage mailables using a web UI.

Offer an online version of your Laravel emails to users.
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

An AngularJS / Laravel app - Keyword Based Email forwarder | read/write emails through IMAP
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

Releases(1.0.0)
  • 1.0.0(Apr 26, 2021)

    It's available now!

    All info described in [README.md](https://github.com/sethsandaru/laravel-mail-switcher/blob/master/README.md]

    Happy coding!

    Source code(tar.gz)
    Source code(zip)
Owner
(Seth) Phat Tran
Mid-Level Full-Stack/Back-end Engineer. A Tech-nerd who loves to build awesome stuff every day with a coffee next to him.
(Seth) Phat Tran
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 Sep 23, 2022
Laravel Mail Catcher Driver

Laravel Mail Catcher Driver This package include a new mailbase driver which will catch all the sent emails and save it to the database. It then expos

Tauqeer Liaqat 94 Aug 30, 2022
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

Appoly 60 Sep 11, 2022
A testing package for intercepting mail sent from Laravel

Laravel Mail Intercept A testing package for intercepting mail sent from Laravel This testing suite intercepts Laravel Mail just before they are sent

Kirschbaum Development Group, LLC 89 Sep 20, 2022
✉️ Laravel Mail Explorer

Mailbook Mailbook is a Laravel package that lets you easily inspect your mails without having to actually trigger it in your application. View demo In

Max Hoogenbosch 63 Sep 12, 2022
Bounce Mail Handler for PHP | This is a "reboot" of PHPMailer-BMH from WorxWare.

PHP 7.0+ Support Composer & PSR-0 Support PHPUnit testing via Travis CI (TODO: more tests needed) PHP-Quality testing via SensioLabsInsight (TODO: mor

Lars Moelleken 41 Mar 25, 2022
:envelope: E-Mail Address Validator (syntax, dns, trash, typo)

✉️ E-Mail Address Validator for PHP Warning The best way to validate an e-mail address is still to send a duplicate opt-in-mail, when the user clicks

Lars Moelleken 39 Jul 28, 2022
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.

null 82 Jan 16, 2022
PostfixAdmin - web based virtual user administration interface for Postfix mail servers

PostfixAdmin An open source, web based interface for managing domains/mailboxes/aliases etc on a Postfix based mail server.

PostfixAdmin 714 Sep 24, 2022
Provides a clean and simple way to configure the WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice

WP PHPMailer provides a clean and simple way to configure the WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice.

Itineris Limited 55 Sep 23, 2022