Download the PHP package julien-its/emails-queue-s6 without Composer
On this page you can find all versions of the php package julien-its/emails-queue-s6. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download julien-its/emails-queue-s6
More information about julien-its/emails-queue-s6
Files in julien-its/emails-queue-s6
Package emails-queue-s6
Short Description Symfony Easy Emails Queue Bundle for symfony 6.*
License GPL-3.0+
Informations about the package emails-queue-s6
Julien-ITS
emails-queue-s65
Features
Service you can use to send your emails to a queue system. All your emails will be stored in your database to keep logs of them. Send your emails directly or with a cron using the queue. Define how many emails you want to send each time you call the process queue action.
Installation
Install with composer
Before installation :
Add in your composer.json
The extra.symfony key will most probably already exist in your composer.json. In that case, add the "endpoint" key to the existing extra.symfony entry.
You can now install it via composer
Instructions
Once installed,
Generate new tables in your database with doctrine
Create a new email service where you will define all your emails methods. We only add one exemple of a contact form email
<?php
namespace App\Services;
use \JulienIts\EmailsQueueBundle\Entity\EmailQueue;
class EmailService
{
const DEFAULT_SUBJECT = "My App";
protected $jitsEmailService;
public function __construct(\JulienIts\EmailsQueueBundle\Services\EmailService $jitsEmailService)
{
$this->jitsEmailService = $jitsEmailService;
}
public function contact($message)
{
$config = array(
'template' => 'EmailsQueueBundle:mail:contact.html.twig',
'templateVars' => array('message' => $message),
'emailFrom' => '[email protected]',
'emailFromName' => 'My app',
'contextName' => 'contact',
'priority' => EmailQueue::HIGH_PRIORITY,
'subject' => self::DEFAULT_SUBJECT.' : Contact',
'emailTo' => '[email protected]',
'emailsBcc' => '[email protected];[email protected]'
);
$this->jitsEmailService->createNewAndProcess($config);
}
}
Note that you can copy the contact.html and email layout on your own appBundle to personalize them
Two possibilities when creating an emailQueue :
$this->jitsEmailService->createNew($config);
$this->jitsEmailService->createNewAndProcess($config);
createNewAndProcess Will directly process the email queue and send it to your mail service.
Send an email
To send your email, call your service in a controller :
Define the cron action
If you went to send emails by packets, you can use the command
php bin/console jits:queue:process --limit 30
All versions of emails-queue-s6 with dependencies
symfony/framework-bundle Version ^6.1
doctrine/doctrine-bundle Version ^2.8
doctrine/orm Version ^3.2
symfony/mailer Version ^6.1