dereuromark / cakephp-queue

Queue plugin for CakePHP - simple, pure PHP and without dependencies.
MIT License
306 stars 137 forks source link

InvalidArgumentException: The email set for "to" is empty #373

Closed Txxkirsch closed 1 year ago

Txxkirsch commented 1 year ago

Hello again,

the following method of queueing mails does not work for me: https://github.com/dereuromark/cakephp-queue/blob/master/docs/sections/tasks/email.md#using-built-in-email-task

I've set my mail-settings like the example and like I'm doing it when I'm mails in the "normal" way but when the mailtask runs I'm getting following error:

2023-03-31 22:51:28 error: Queue.Email (job 3)
InvalidArgumentException: The email set for "to" is empty.
#0 /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Mailer/Message.php(692): Cake\Mailer\Message->validateEmail()
#1 /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Mailer/Message.php(475): Cake\Mailer\Message->setEmail()
#2 /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Mailer/Email.php(507): Cake\Mailer\Message->setTo()
#3 /var/www/html/xdev_vidb4/vendor/dereuromark/cakephp-queue/src/Queue/Task/EmailTask.php(232): Cake\Mailer\Email::deliver()
#4 /var/www/html/xdev_vidb4/vendor/dereuromark/cakephp-queue/src/Queue/Processor.php(216): Queue\Queue\Task\EmailTask->run()
#5 /var/www/html/xdev_vidb4/vendor/dereuromark/cakephp-queue/src/Queue/Processor.php(164): Queue\Queue\Processor->runJob()
#6 /var/www/html/xdev_vidb4/vendor/dereuromark/cakephp-queue/src/Command/RunCommand.php(110): Queue\Queue\Processor->run()
#7 /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Console/BaseCommand.php(189): Queue\Command\RunCommand->execute()
#8 /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Console/CommandRunner.php(334): Cake\Console\BaseCommand->run()
#9 /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Console/CommandRunner.php(172): Cake\Console\CommandRunner->runCommand()
#10 /var/www/html/xdev_vidb4/bin/cake.php(12): Cake\Console\CommandRunner->run()
#11 {main} [1s, 20MB] (pid 173779) {Nix}

I tried many variants of setting the To-field - none of them worked. But if I change my Email-configuration to queue and leave my Mailer it works fine.

Could you please investigate?

Thanks in advance!

Txxkirsch commented 1 year ago

I have to add: just changing the configuration only works on mails which don't have an attachment. if there is an attachment you get an ORM-Error because the content is too large.

2023-04-01 00:12:30 error: [PDOException] SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'data' at row 1 in /var/www/html/xdev_vidb4/vendor/cakephp/cakephp/src/Database/Statement/MysqlStatement.php on line 3
Txxkirsch commented 1 year ago

Today I tried it again and it works. Dont know what I'm doing differently. But I'm closing the issue since I cant reproduce it.