Coder Social home page Coder Social logo

yii2-mailqueue's People

Contributors

3064709 avatar akorinek avatar apolyntsev avatar bbrunekreeft avatar beroso avatar diego-betto avatar lukesky1 avatar macklus avatar marcogermani87 avatar nterms avatar peterngockhoa avatar saranga-kraken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-mailqueue's Issues

Tag the lib please

I had to tag the library (0.0.1) in my fork to make my composer require it.
Could you add a tag, please?
So that I don't have to use a forked repository to load it.

Memory exhausted when queueing "a lot" of emails

First, thanks for the wonderful extension! I have been using without issue till now:

For a certain case I tried to queue 1500 emails, but the script exploded around the 500 emails.

Email is no complex, the generated .eml when using fileTransport is 20kb.

Making some db optimizations so all the data is grabbed in one query I was able to make it queue around 700 emails.

After other tests, it seems that the issue is on Yii::$app->mailer->queue().

Any ideas on this?

Thanks!

Install error

Seems that yiisoft/yii2-swiftmailer has changed their version.
when i run composer require --prefer-dist nterms/yii2-mailqueue "*" it hangs:

    - nterms/yii2-mailqueue dev-master requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.9 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.8 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.7 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.6 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.5 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.4 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.3 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.2 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.14 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.13 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.12 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.11 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.10 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - nterms/yii2-mailqueue 0.0.1 requires yiisoft/yii2-swiftmailer ~2.0.0 -> satisfiable by yiisoft/yii2-swiftmailer[2.0.0, 2.0.0-alpha, 2.0.0-beta, 2.0.0-rc, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7] but these conflict with your requirements or minimum-stability.
    - Installation request for nterms/yii2-mailqueue * -> satisfiable by nterms/yii2-mailqueue[0.0.1, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.14, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, dev-master].

Migrations fails

Migration fails because method init of the module throws an exception on init method if table is not found. And migrations request module instance to get the table name. which triggers init.

Schedule emails

It would be very nice to schedule emails, bij adding a time_to_send column (DATETIME) to the database.
The Message::queue method should have to accept an optional timestamp, which will be used to fill the time_to_send column.
The MailQueue::process method only has to process the mails with time_to_send <= NOW()

option to delete message from queue when sent

It would be nice to have an option in the configuration to delete the sent messages from the db. I'm sending out signup mails with passwords and those should not stay in the db longer than necessary.

MailQueue->process send message

Hello,
Should MailQueue->process be using the '$this->send' message function instead of by passing they logging and transport options. Instead of $this->sendMessage?

Queueing for a long time

Hi,

I understand that queueing works by serializing and unserializing whole swift mailer message object.

If the message object is set for posting into long future and in the meantime with some upgrade the swiftmailer message object changes, then unserializing will fail.

It would be much safer to store email as a binary text without unserializing - separate headers and body. Unserializing is not only error prone, but also stores bunch of useless object data (with swift message are also serialized other related in-memory swift objects).

We have customers who wants to send email reminder for example next year. With serializing/unserializing we could not do any safe upgrade of swift mailer until last email posted.

Unlike swift mailer, PHP mailer exposes two methods PreSend and PostSend. First one allows fetching separate headers & body as a binary text suitable to async post:

if($mail->PreSend()){
   // no serialized objects, just binary texts:
   $modelMail->header = $mail->getMIMEHeader();
   $modelMail->body = $mail->getMIMEBody();
   $modelMail->save();
}

Then next year without any dependency on mailer related objects we can just pull data from DB & post:

$modelMail->findOne(123);
$mail->setMIMEHeader($modelMail->header);
$mail->setMIMEBody($modelMail->body);
if($mail->PostSend()){
   ++$success;
}

That's why we cannot use swiftmailer, it's not suitable for queueing unlike PHPMailer - there is no method to store separately headers & body as a binary text in swift mailer.

Does it support mailer 2.1

Does it support mailer 2.1?I allowed the console command "php yii mailqueue/process" on 2.1. The error content was "Exception'Swift_TransportException' with message'Process could not be started [The system cannot find the path specifie".Is it the version reason?

Transport stop implemention

when using ->send() and not adding ->transport->stop() it crashes at some point(Due to sslshit or timeout e.t.c.) .. Maybe add callback so I could stop transport ?

PHP Warning 'yii\base\ErrorException' with message 'mkdir(): Permission denied'

I always come across this kind of bug:

PHP Warning 'yii\base\ErrorException' with message 'mkdir(): Permission denied'
in/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php

Or

PHP Warning 'yii\base\ErrorException' with message 'mkdir(): No such file or directory'
in/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php

I am so confused about it

Error when using aliases in view

return Yii::$app->mailqueue->compose("@frontend/views/emails/newJob", [
                        'name' => $job->FullName,
                        'email' => $job->Email,
                        'address' => $job->FullAddressHtml,
                        'price' => $job->price,
                        'url' => Yii::$app->urlManager->createAbsoluteUrl(['job/review', 'url' => $job->url]) 
                    ])
                    ->setFrom(\Yii::$app->params['fromEmail'])
                    ->setTo($job->Email)
                    ->setSubject('New Order')
                    ->queue();

gives errror
The view file does not exist: /var/www/xx/frontend/mail/layouts/html.php

This works correctly when using the swiftmailer directly.
At the moment I am added this to the compose function
$this->htmlLayout = "@common/mail/". $this->htmlLayout;

Set priority to emails

Be able to pass a priority parameter to queue() so those with lower value priority gets processed first

Echo should not be used

I don't think an echo should be used to output info while sending mails.
In the most recent release (0.0.5), there is a lot of output.
This is not needed. I use this in a cron job and now I get an email every minute with the message 'no email to send' ...

Attachment not sent

Hello, i'm tryng to convert some code that sends single messages to use the queue.
The code is like this:
\Yii::$app->mailqueue->compose('generic',[
'content' => $msg
])
->setFrom('[email protected]')
->setTo($iscritto->email)
->setSubject('Attestato di partecipazione al corso '.$corso->titolo)
->setTextBody('In allegato inviamo l'attestato di partecipazione alla sessione del '.$model->dataV.' per il corso '.$model->corso->titolo)
->attachContent($attach, ['fileName' => 'attestato.pdf', 'contentType' => 'application/pdf'])
->queue();

The problem is that the attachment is not sent when i process the queue; it is not even saved in the db table of the queue

What can be the issue?

queue() method in Message.php seems incomplete

Hi,

I just encountered a problem where queue was saving just the subject in mailqueue table. Upon inspection and comparing to old version it seems queue() function lacks the code that set from/to, attachements etc. Is this case of committing wrong code?

Thanks

Compose Mail with attachContent error data too long for DB

I have use function attachContent to attach pdf content. And got Data too long for column.
Database: MySql

$cmd = Yii::$app->mailer->compose()->setFrom()->setTo()->setSubject();

$cmd->attachContent($attachContent,["fileName"=>"name.pdf"]);

$cmd->queue();

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'swift_message' at row 1

For workaround I have change the column swift_message from text to long text.

Implementing sending timetout

For some applications sending emails should be done in a timely manner, for instance when sending a validation code by email.
If for some reasons the sending process is not running mails will remain in the queue until the process() function is called. Which may happen a day later for instance. It would not be practical to send 1 day delayed validation code emails in our case.

I propose, as an enhancement, to add a public attribute to the class to define a timeout. The sending process shall then ignore all pending emails where the sentTime is less than now() - timeout

MailQueue->process(): message contained attachment cannot be unsearilzed

yii mailqueue/process

PHP Notice 'yii\base\ErrorException' with message 'unserialize(): Error at offset 49151 of 49151 bytes'

in /app/vendor/nterms/yii2-mailqueue/models/Queue.php:70

have following code:

        $ret = Yii::$app->mailqueue->compose(
            '@app/views/mail/feedback_mail',
            [
                'appVersion'    => $data->browser->appVersion,
                'userAgent'	    => $data->browser->userAgent,
                'platform'	    => $data->browser->platform,
                'url'	        => $data->url,
                'note'	        => $data->note,
                'imagedata'	    => $data->img,
            ]
        )
        ->setFrom( Yii::$app->params['mail']['mailFromEmail'] )
        ->setTo( Yii::$app->params['mail']['feedbackEmail']  )
        ->setSubject('Site feedback')
        ->queue();

View:

<html>
    <body>
    <img src="<?= $message->embed($imagedata); ?>">
</body>

File attachments to emails

I liked your extension, thank you very much for the work done.
I customize it to your project.
But I was surprised that there was no possibility of attach files to emails which fall into place.
Or I do not understand something?
I suppose that you can add another column to the database, which would be stored in the path to the attachment files.
(Attachable files, respectively, should be pre-loaded)
I think that this feature would be very useful.
Thank you.
Sorry for my English


Мне понравилось ваше расширение, огромное спасибо за проделанную работу.
Настроил его на своем проекте.
Но я удивился, что нет возможности вложить файлы к письмам которые попадают в очередь.
Или я что то не понял?
Предполагаю, что можно, добавить еще один столбец в базу данных, в котором бы хранились пути до прикрепляемых файлов.
(прикрепляемые файлы, соответственно должны быть заранее загруженны)
Считаю, что данная возможность была бы весьма полезной.
Спасибо.

[Bug] Error when composer update - Add column swift_message

It throws error when sending email, `Setting unknown property:

nterms\mailqueue\models\Queue::swift_message

Migration can not be updated, ti throws error:

PHP Fatal Error 'yii\base\ErrorException' with message 'Class 'MailQueue' not found'

in /var/www/html/vsource-payment/vendor/nterms/yii2-mailqueue/migrations/m161111_080914_add_swift_message_column_to_mail_queue_table.php:15

Exception 'yii\base\UnknownMethodException' with message 'Calling unknown method: m161111_080914_add_swift_message_column_to_mail_queue_table::longtext()'

can not send email

Dear Sir,

I come across a problem, the yii2-mailqueue cannot send mail, I saw the message in MySQL database but it not dequeue and there is no error message. I am so confused about it.

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.