Mautic fails to send mail

Hi, I am running v.1.3.1 and it fails to send mail. First of all all files have www-data:www-data and the default permissions. When i run the cron commands manually i get permission errors. This could be because i run them as the user arjon and not www-data. How do i fix this?



When i send the emails manually from the app, it says all were sent but actually none was sent. Email settings are fine because it sends the test email.



If i run

Code:
php /var/www/marketing.domain.com./app/console mautic:leadlists:update --env=prod
I get:
Code:
Rebuilding leads for list 2 0 total lead(s) to be added in batches of 300 total lead(s) to be removed in batches of 300 0 lead(s) affected

Rebuilding leads for list 1
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 3
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 4
0 total lead(s) to be added in batches of 300
0 total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 5
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

PHP Warning: file_put_contents(/var/www/marketing.domain.com/app/cache/prod/…/script_executions.json): failed to open stream: Permission denied in /var/www/marketing.domain.com/app/bundles/CoreBundle/Command/ModeratedCommand.php on line 85

Hi, I am running v.1.3.1 and it fails to send mail. First of all all files have www-data:www-data and the default permissions. When i run the cron commands manually i get permission errors. This could be because i run them as the user arjon and not www-data. How do i fix this?

When i send the emails manually from the app, it says all were sent but actually none was sent. Email settings are fine because it sends the test email.

If i run

php /var/www/marketing.domain.com./app/console mautic:leadlists:update --env=prod

I get:

[code]Rebuilding leads for list 2
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 1
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 3
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 4
0 total lead(s) to be added in batches of 300
0 total lead(s) to be removed in batches of 300
0 lead(s) affected

Rebuilding leads for list 5
0 total lead(s) to be added in batches of 300
total lead(s) to be removed in batches of 300
0 lead(s) affected

PHP Warning: file_put_contents(/var/www/marketing.domain.com/app/cache/prod/…/script_executions.json): failed to open stream: Permission denied in /var/www/marketing.domain.com/app/bundles/CoreBundle/Command/ModeratedCommand.php on line 85
[/code]

The log doesn’t tell anything:

[2016-05-05 12:22:38] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/marketing.domain.com/app/cache/prod/classes.php - at line 423 [] []
[2016-05-05 14:59:24] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/marketing.domain.com/app/cache/prod/classes.php - at line 423 [] []
[2016-05-05 15:36:31] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/marketing.domain.com/app/cache/prod/classes.php - at line 423 [] []
[2016-05-05 15:38:26] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/marketing.domain.com/app/cache/prod/classes.php - at line 423 [] []
[2016-05-05 16:45:11] mautic.NOTICE: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php5/sessions) failed: Permission denied (13) - in file /var/www/marketing.domain.com/app/cache/prod/classes.php - at line 423 [] []
[2016-05-05 18:50:38] mautic.WARNING: IP LOOKUP: The file "/var/www/marketing.domain.com/app/cache/prod/../ip_data/GeoLite2-City.mmdb" does not exist or is not readable. [] []

Email sending is fixed now. The only problem are cron jobs.