# Mautic fails to send mail

**URL:** <https://forum.mautic.org/t/mautic-fails-to-send-mail/3660>\
**Category:** Product Support\
**Created:** [May 5, 2016, 6:28pm UTC](https://forum.mautic.org/t/mautic-fails-to-send-mail/3660 "2016-05-05T18:28:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [May 5, 2016, 6:28pm UTC](https://forum.mautic.org/t/mautic-fails-to-send-mail/3660/1 "2016-05-05T18:28:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [May 5, 2016, 6:28pm UTC](https://forum.mautic.org/t/mautic-fails-to-send-mail/3660/2 "2016-05-05T18:28:19Z")

</div>

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

```auto
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]

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [May 5, 2016, 6:33pm UTC](https://forum.mautic.org/t/mautic-fails-to-send-mail/3660/3 "2016-05-05T18:33:56Z")

</div>

The log doesn’t tell anything:

```auto
[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. [] []

```

---

<div class="post-metadata">

**Author:** ![arjon](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@arjon](https://forum.mautic.org/u/arjon)\
**Post date:** [May 5, 2016, 7:28pm UTC](https://forum.mautic.org/t/mautic-fails-to-send-mail/3660/4 "2016-05-05T19:28:41Z")

</div>

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