Coder Social home page Coder Social logo

mail-queue's Introduction

SelBil Mail Queue

This mail queue created for organising your mail queue and making your server more easer. By using Mail Queue class you can :

  • Add sender and receiver your queue
  • In your cron jobs files or another set mailer and run queue
  • You can watch your mail status from your database and resend your mail to your customer or someone else

Installation

Cloning

You can download as a .zip file by clicking above or clone this repository :

	git clone https://github.com/selbil/mail-queue.git

With Composer

You can use this class from composer

	composer require "selbil/mail-queue":"dev-master"

Usage

main.php

	// Use it because of truer sending and log
	date_default_timezone_set("Europe/Istanbul");

	// Require or include your composer autoloader
	require_once "vendor/autoload.php";

	$queueConfig = [
		"dbname"	=> "my_queue_test_db",
		"sender"	=> "[email protected]",
	];

	// SelBil Mail Queue uses this default config, you can customize it with setConfig() function
	/*
		public $defaultConfig = [
		    "host"      => "localhost",
		    "port"      => 3306,
		    "dbname"    => "your-db-name",
		    "charset"   => "UTF8",
		    "username"  => "root",
		    "password"  => "root",
		    "table"     => "mail_queue",
		    "sender"    => NULL,
		    "senderName"=> NULL,
		    "reply"     => NULL,
		    "replyNAme" => NULL
		];
	*/

	$queue = new Selbil\MailQueue\Queue;

	// Set your database config and create schema for mail queue
	// SelBil Mail Queue uses MySQL
	$queue->setConfig($queueConfig)
		->createSchema();

cron-for-queue.php

	date_default_timezone_set("Europe/Moscow");
	
	require 'vendor/autoload.php';
	
	// We are re-initilizating our database config file for reading
	$config = [
		"dbname"	=> "your-db-name",
	];
	
	// These are for your smtp mail server config
	// I am using my Gmail account for testing
	$mailConfig = [
		"host" 		=> "smtp.gmail.com",
		"username"	=> "[email protected]",
		"password"	=> "my-beautiful-password"
	];

	
	$mailer = new Selbil\MailQueue\Mail;
	
	// Database config registration
	$mailer->setDatabaseConfig($config);

	// Mailer config registration
	$mailer->setConfig($mailConfig);
	
	// Number of mail for one cycle
	$mailer->setLimit(5);

	// Run the query for your customers or users
	$mailer->run();

Regards to PHPMailer

This repository uses PHPMailer and all of its components for easier mail sendings. You can read the documentation of PHPMailer from https://github.com/PHPMailer/PHPMailer/wiki/Tutorial

Selbil Mail Queue use PHPMailer instance in Mail class as public $mailervariable. You can use all the features after setting Mail class config.

Thank you for support!

mail-queue's People

Contributors

emredoganm avatar nemon avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

seigieu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.