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

worker not sending email while using Php mailer #61

Closed
sandeepkundu4344 opened this issue Sep 17, 2015 · 10 comments
Closed

worker not sending email while using Php mailer #61

sandeepkundu4344 opened this issue Sep 17, 2015 · 10 comments

Comments

@sandeepkundu4344
Copy link

public $default = array(
'transport' => 'Mail',
'from' => 'test@myserver.com'
);

I am using above settings in my email config and using crontab
*/10 * * * * cd /var/www/html/beta/app/ && Console/cake Queue.Queue runworker > /tmp/queque.txt

cron tab runs every 10 minutes but email is not sending from php when i use some Smtp transport it start sending emails.

Note => when i run script manually using a web script
public function runJob(){

   echo exec('cd /var/www/html/beta/app/ && nohup Console/cake Queue.Queue runworker &');
   die('done');

}

it sends mail with Php transport but when it is started from crontab it goes to failure
what am i doing wrong here ?

@dereuromark
Copy link
Owner

What user are you running it with for crontab?
Should be www-data or alike

@sandeepkundu4344
Copy link
Author

yes it was running under root prior then i tried with apache by using crontab -u apache -e
but no success

@dereuromark
Copy link
Owner

what is the logged error incl stracktrace?
Did you make sure the files are all accessible from that user?
If you run it first with root you might sabotage that

@sandeepkundu4344
Copy link
Author

I do not have access to the server right now i can get that error output in a while but how to get "logged error incl stracktrace" where is this file ?
yes when i run the script manually as apache user from web it works perfectly from http url

If you run it first with root you might sabotage that --- how to check this ?

@dereuromark
Copy link
Owner

ls -l checks for the permissions of the file and owner. check the cache (persistent, models) especially.

the log files are in /tmp/logs probably, or if a more severe PHP error in the apache logs.

@sandeepkundu4344
Copy link
Author

2015-09-20 00:29:43 Error: (line 78 in /var/www/html/beta/lib/Cake/Network/Email/MailTransport.php)
#0 /var/www/html/beta/lib/Cake/Network/Email/MailTransport.php(51): MailTransport->_mail('darinredding1@g...', 'SOVA - Email V...', '--2d7cce341ad92...', 'From: noreply@s...', NULL)
#1 /var/www/html/beta/lib/Cake/Network/Email/CakeEmail.php(1161): MailTransport->send(Object(EmailLib))
#2 /var/www/html/beta/app/Plugin/Tools/Lib/EmailLib.php(506): CakeEmail->send('<html xmlns='ht...')
#3 /var/www/html/beta/app/Plugin/Queue/Console/Command/Task/QueueEmailTask.php(110): EmailLib->send('<html xmlns='ht...')
#4 /var/www/html/beta/app/Plugin/Queue/Console/Command/QueueShell.php(216): QueueEmailTask->run(Array, '14')
#5 /var/www/html/beta/lib/Cake/Console/Shell.php(445): QueueShell->runworker()
#6 /var/www/html/beta/lib/Cake/Console/ShellDispatcher.php(209): Shell->runCommand('runworker', Array)
#7 /var/www/html/beta/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#8 /var/www/html/beta/app/Console/cake.php(47): ShellDispatcher::run(Array)
#9 {main}

this is the cake error i got from error.log file
why this is happening can you help here please
same error i get on my local because we can not send mail using php transport from localhost but why same is happening on live server

@dereuromark
Copy link
Owner

This is an issue with your local email setup. I recommend to always use Smtp or alike as I do.
Sounds like this will also fail with any non queue code that directly uses mailer. Closing.

@sandeepkundu4344
Copy link
Author

This is an issue with your local email setup. I recommend to always use Smtp or alike as I do.
Sounds like this will also fail with any non queue code that directly uses mailer. Closing.

Totally wrong assumption, as i told in my comments its working when i run the worker from script
echo exec('cd /var/www/html/beta/app/ && nohup Console/cake Queue.Queue runworker &');
die('done');

}

i have used non-queue mail over 10 times in the application and its working fine so it is not the case but you closed the issue without discussing for a solution :-(

@dereuromark
Copy link
Owner

crontab != user executing your custom script.
it really is most likely your local setup, and not this code.

@sandeepkundu4344
Copy link
Author

Sorry I do not understand your last comment.

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