Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send email via command line using runworker #44

Closed
jaychakra opened this issue Jun 12, 2015 · 5 comments
Closed

Unable to send email via command line using runworker #44

jaychakra opened this issue Jun 12, 2015 · 5 comments

Comments

@jaychakra
Copy link

Hi,
I am trying to implement the 2.x version of this plugin in my cakephp V2.6.1. I have installed it correctly. Updated the database with new tables. Then made an action in controller to add email tasks in queue. Till this point everything is working fine. But while running the Queue from the command line. I am getting the following error.

Running Job of type "Email"
Queue Email task called without settings data.
Job did not finish, requeued.
@dereuromark
Copy link
Owner

You will have to properly initialize an Emali task, including the settings (where to, ...). See the test cases maybe.

@jaychakra
Copy link
Author

I have initialized the task like this

$this->loadModel('Queue.QueuedTask');
$this->QueuedTask->createJob(
            'Email', array(
                'domain'=>'mydomain.com',
                'to' => 'myemail@domain.com',
                'from'=>array('to@domain.com' => 'Name'),
                'subject'=>'Test'
            )
       );

Am I missing something??

@dereuromark
Copy link
Owner

You did not look into the test cases as I told you, did you? ;)
They clearly state how it should be done or how it is expected (if you don't want to look in the source code directly, where it also points to the solution):

    $data = [
        'settings' => [
            'subject' =>...,
            'to' => ...,
            'domain' => 'example.org',
        ],
        'vars' => [
            'content' => 'I am a test',
        ]
    ];

    if ($this->QueuedTask->createJob('Email', $data)) { ... }

@jaychakra
Copy link
Author

Sorry for the earlier mistake.

I have made the above changes but there is still an error regarding unavailability of tools.

Running Job of type "Email"
Error: Plugin Tools could not be found.
#0 /home/gloryque/public_html/quarc/lib/Cake/Core/App.php(227): CakePlugin::path('Tools')
#1 /home/gloryque/public_html/quarc/lib/Cake/Core/App.php(549): App::path('Lib', 'Tools')
#2 [internal function]: App::load('EmailLib')
#3 /home/gloryque/public_html/quarc/app/Plugin/Queue/Console/Command/Task/QueueEmailTask.php(104): spl_autoload_call('EmailLib')
#4 /home/gloryque/public_html/quarc/app/Plugin/Queue/Console/Command/QueueShell.php(221): QueueEmailTask->run(Array, '28')
#5 /home/gloryque/public_html/quarc/lib/Cake/Console/Shell.php(445): QueueShell->runworker()
#6 /home/gloryque/public_html/quarc/lib/Cake/Console/ShellDispatcher.php(209): Shell->runCommand('runworker', Array)
#7 /home/gloryque/public_html/quarc/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#8 /home/gloryque/public_html/quarc/app/Console/cake.php(47): ShellDispatcher::run(Array)
#9 {main}

@dereuromark
Copy link
Owner

That is also documented (and visible in the code).
This task uses and requires the Tools plugin.
Write your own Email task to use the Cake core email lib if that's what you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants