Here’s what I see when I run the Cron Job manually.
***@*** [~]# /usr/local/bin/php /home/***/public_html/ninja/artisan ninja:send-reminders
Thu, 21 Dec 2017 21:40:11 +0000 Running SendReminders...
1 accounts found with fees
MyCompany: 1 invoices found
Charge fee: 28
1 accounts found with reminders
MyCompany: 1 invoices found
Send email: 28
Done
***@*** [~]#
NOTE: EMAIL DRIVER: SMTP
I am able to send email from InvoiceNinja GUI using CLIENTS>INVOICE>EMAIL_INVOICE>SEND_EMAIL
hillel
December 21, 2017, 7:42pm
2
I’m not sure, I’d suggest trying to send the invoice with id #28 directly in the app itself.
Also, are there any errors in the logs in storage/logs/laravel-error.log
No errors in the logs in storage/logs/laravel-error.log
Is the “invoice id #” the same as the “Invoice Number”?
If no, how would I lookup invoices by id #?
If yes, I don’t have any invoices with the “Invoice Number 28”, any suggestions?
-Thanks
hillel
December 21, 2017, 8:01pm
4
Here’s a SQL query to find it: select invoice_number from invoices where id = 28;
Okay, found the “Invoice Number” of “invoice id #28 ”.
Went to the my self-hosted app of Invoice Ninja>Invoices>Invoice_Number>Email_Invoice>Email Sent and Received.
I’ve not had any problems manually sending emails, only difficulty has been auto sending via cron.
Any suggestions?
Thank you.
hillel
December 21, 2017, 8:53pm
6
Are you using Docker, I’ve seen cases where the .env variables are used by the app but not the CLI commands.
Nope, I’m using Softaculous via CPanel.
hillel
December 21, 2017, 9:09pm
8
Try uncommenting this line of code, running the command and then checking storage/logs/laravel-info.log for the message.
https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/Mailers/Mailer.php#L53
Bye the way, thank you for the support, Invoice Ninja is amazing enough on it’s own, but knowledgeable and helpful support just makes me love what ya’ll are doing that much more, seriously thanks.
Okay back to this mailer…
I uncommented the code on Line 53: \Log::info("{$toEmail} | {$replyEmail} | $fromEmail");
Ran the Cron Job manually.
Checked “storage/logs/laravel-info.log”
And got this…
[2017-12-22 08:40:58] production.INFO: Clients_Emails@.com | My_Reply-to_Email@ .com | From-Address@mydomain.com [] []
[2017-12-22 08:40:58] production.INFO: Reply-to_Email@.com | From-Address@mydomain.com | From-Address@mydomain.com [] []
[2017-12-22 08:41:05] production.INFO: Clients_Emails@ .com | My_Reply-to_Email@.com | From-Address@mydomain.com [] []
[2017-12-22 08:41:06] production.INFO: Reply-to_Email@ .com | From-Address@mydomain.com | From-Address@mydomain.com [] []
[2017-12-22 08:41:11] production.INFO: Clients_Emails@.com | My_Reply-to_Email@ .com | From-Address@mydomain.com [] []
[2017-12-22 08:41:11] production.INFO: Reply-to_Email@***.com | From-Address@mydomain.com | From-Address@mydomain.com [] []
hillel
December 21, 2017, 10:12pm
10
Maybe the CLI doesn’t have permission to write to the error log? Try running the artisan command as sudo and then check laravel-error.log.
Unfortunately, I confirmed with my hosting provider that my Shared Hosting Plan does not include SUDO access.
I did however, open up permissions for laravel-error.log and laravel-info.log to 777.
And then ran ARTISAN command again, but no change and no info created for laravel-error.log.
hillel
December 23, 2017, 5:32am
12
You could try adding calls to \Log::info in the handleSuccess and handleFailure methods of the file to see the result.
Just to clarify…since I’m terrible with PHP.
Add this “\Log::info”
To this file “/app/Ninja/Mailers/Mailer.php”
Under private function handleSuccess($response, $data)
Like this…
private function handleSuccess($response, $data)
{
if (isset($data['invitation'])) {
$invitation = $data['invitation'];
$invoice = $invitation->invoice;
$messageId = false;
\Log::info
And under private function handleFailure($exception)
Like this…
private function handleFailure($exception)
{
if (isset($_ENV['POSTMARK_API_TOKEN']) && method_exists($exception, 'getResponse')) {
$response = $exception->getResponse();
\Log::info
If not, could you please provide an example of the code, thanks again.
hillel
December 23, 2017, 11:01am
14
You’d need something like \Log::info(‘success’);
Added \Log::info('success');
to “/app/Ninja/Mailers/Mailer.php”
Like this…
private function handleSuccess($response, $data)
{
if (isset($data['invitation'])) {
$invitation = $data['invitation'];
$invoice = $invitation->invoice;
$messageId = false;
\Log::info('success');
Then checked “storage/logs/laravel-info.log”
Which showed this…
production.INFO: Clients_Emails@.com | My_Reply-to_Email@ .com | From-Address@mydomain.com [] []
production.INFO: success [] []
production.INFO: Bcc_Email_Addr@.com | My_Reply-to_Email@ .com | From-Address@mydomain.com [] []
Any suggestions?
hillel
January 22, 2018, 10:54pm
16
I’m not sure… can you check the email logs to see if it’s sent.
Sure,
Where can I find the email logs?
Are you referring to the “Activity” section within “View Client”?
hillel
January 25, 2018, 9:33am
18
It depends on the email provider you’re using, most provide a way to check which emails have been processed.
devIn
September 2, 2022, 7:24am
19
Hello, We have same issue, have anyone got the solution.