Cant send email via smtp

Hello everyone, already during the installation I could not successfully set up the SMTP settings and had to continue with Log.

After the installation I changed my settings in the .env to “smtp”. Unfortunately my invoices are not being sent. I don’t get an error.

(Self hosted on Plesk Server with Invoice-Ninja v5.1.14-C44)

Regards Jan

Hi,

Have you seen the info here:

https://invoiceninja.github.io/docs/self-host-troubleshooting/

Yes I have checked it. But i think i have a problem with setup the cron.

I cant execute the crons in Plesk. And the triangle is still standing.

Command: cd httpdocs/invoice.mydomain.de && /opt/plesk/php/7.3/bin/php artisan schedule:run


Error message in plesk:
-: /opt/plesk/php/7.3/bin/php: No such file or directory

Which or how much crons i need to setup?

Maybe PHP is in a different folder?

No the folder is correct.

root@server:/opt/plesk/php/7.3/bin# ls -la
insgesamt 22276
drwxr-xr-x 2 root root    4096 Mär 10 00:40 .
drwxr-xr-x 8 root root    4096 Dez 23 07:51 ..
-rwxr-xr-x 1 root root 5619112 Feb 17 13:16 lsphp
-rwxr-xr-x 1 root root     358 Feb 17 13:16 pear
-rwxr-xr-x 1 root root     383 Feb 17 13:16 peardev
-rwxr-xr-x 1 root root     279 Feb 17 13:16 pecl
lrwxrwxrwx 1 root root       9 Feb 17 13:16 phar -> phar.phar
-rwxr-xr-x 1 root root   14825 Feb 17 13:16 phar.phar
-rwxr-xr-x 1 root root 5710752 Feb 17 13:16 php
-rwxr-xr-x 1 root root 5599888 Feb 17 13:16 php-cgi
-rwxr-xr-x 1 root root 5833960 Feb 17 13:16 phpdbg

Maybe this will help

Thanks, now the cron is configured: cd /var/www/vhosts/mydomain.de/httpdocs/invoice.mydomain.de && /opt/plesk/php/7.3/bin/php artisan schedule:run

But if i sent an invoice the mail will not send.

Cant find any errors in laravel.log

Have you reviewed the info here:

https://invoiceninja.github.io/docs/self-host-troubleshooting/

Yes. Yesterday it works for a moment. Now it is not working.

Which of these cron jobs are needed?

cd /var/www/vhosts/mydomain.de/httpdocs/invoice.mydomain.de && /opt/plesk/php/7.3/bin/php artisan schedule:run

cd /var/www/vhosts/mydomain.de/httpdocs/invoice.mydomain.de && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

cd /var/www/vhosts/gbc-aussenanlagen.de/httpdocs/invoice.gbc-aussenanlagen.de && /usr/bin/php -d register_argc_argv=On artisan schedule:run >> /dev/null 2>&1

@david can you please help here?

Couple of things to check:

Are there any records in the jobs table of the database? this would indicate that you have enabled queues but have not setup the queue listener.

If there are no jobs in the database table, then there is either:

  1. A problem with the SMTP configuration - check storage/logs/laravel.log for more info.
  2. The SMTP details are correct, but the service is returning an internal error - check the system_logs table in the database for more information
  3. The company is deactivated - Check Settings Account management and ensure the company is activated.

Similar issue here…sounds like the same based on what I’m reading. I did a fresh install, on Ubuntu with Apache. Cron is configured and appears to be running. I noticed emails were not being sent. Jobs table has a LOT of records. You mentioned a queue listener not being set up… How is that done? I haven’t run across that in install docs, unless I missed it? I didn’t have this issue with the previous install (same server).

Hi David,

my smtp settings are correct.

And now it works. Every 5 minutes the mails will be sent.

I have setup this cron job in plesk:
*/5 * * * *
root
cd /var/www/vhosts/mydomain.de/httpdocs/invoice.mydomain.de && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

I am happy and it works but which cron job is needet for sending mails in realtime?

So you’ll need to start the queue,

php artisan queue:listen

Going forward you’ll either need to setup the queues, or remove queues by editting your .env file and changing

QUEUE_CONNECTION=database

to

QUEUE_CONNECTION=sync

@Balticsurfer

The scheduler is different to the queue’s

Please see my previous about queue configuration or disabling it.

Okay thank you. But for the server perfomance the cron who is runnig every 5 minutes will be better right?

My cron config who works fine in Plesk:
*/5 * * * *
root or plesk systems user of the specific webserver
cd httpdocs/invoice.mydomain.de && /usr/bin/php -d register_argc_argv=On artisan queue:work --stop-when-empty

The scheduler only checks if there is anything to do every minute… most often it does nothing, but Laravel requires every minute in it specification.

I have follow all the instructions here and on install. I can not get this to send anything via gmail. I get the successfully sent email at the bottom of the screen. I get no errors anywhere. I really like V5. Under users detail. I don’t get enable google either like the demo version. I can’t find my old license I just purchased a few months ago. I don’t know if that makes a difference.

I found the problem. I don’t understand why I am getting this error.

Address in mailbox given [] does not comply with RPC 2822

You need a valid email address and a valid FROM name also, if the from name is blank you’ll get this error.

You can set the from name as an .env variable like this

MAIL_FROM_NAME='jimmy giggles'