Attachment issue with Cron: add attachment error

Hi,
I am experiencing this issue with phplist 3.3.1 as well as the previous version on Debian linux with ISPConfig panel. I can successfully queue and process campaings by using the browser, both with and without attachments. I also set up cron and is works fine as long as the campaing does not include attachments.

If the campaing is queued with an attachment, it fails and continue retrying on each cronjob run with the same error. The relevant line might be

add attachment error

Full log below. I suppose I am runnung the shell script with wrong user/permissions but I can’t figure out how to fix it.

Please find below the cronjob, phplist config file, environment details and comments.
I have root access and can provide further details.

cronjob
* * * * * /root/bin/phplist.sh -pprocessqueue >> /root/phplist-cron.log
(runs every minute just to test with one recipient)

bash script
#!/bin/bash
sudo -u web1 /usr/bin/php /var/www/xxx.yyy.com/web/lists/admin/index.php -c /var/www/xxx.yyy.com/web/lists/config/config.php $*
(I tryied to run the script both as root and as the apache user: web1 is the apache user created by the ispconfig panel)

process output/errors (verbose)
Mon Sep 4 16:48:01 CEST 2017
phpList version 3.3.1 © 2000-2017 phpList Ltd, http://www.phplist.com
phpList - Tempo massimo per l’elaborazione della coda: 99999 [0,0080320000] (101)
phpList - Recently sent : 0
phpList - Iniziata [0,0042600000] (104)
phpList - Sending in batches of 1,000 emails [0,0003130000] (107)
phpList - select id from phplist_message where status not in (“draft”, “sent”, “prepared”, “suspended”) and embargo [0,0003060000] (108)
phpList - Elaborazione iniziata, [0,0023390000] (111)
phpList - Un messaggio da elaborare. [0,0008810000] (113)
phpList - L’invio di questo messaggio verrà interrotto, se è ancora in corso per 6 giorni 23 ore 59 minuti 59 secondi [0,0067540000] (130)
phpList - Elaborazione messaggio 119 [0,0374350000] (150)
phpList - Ricerca utenti… [0,0121510000] (155)
phpList - User select query select distinct u.id from phplist_listuser as listuser
inner join phplist_user_user as u ON u.id = listuser.userid
inner join phplist_listmessage as listmessage ON listuser.listid = listmessage.listid
left join phplist_usermessage as um ON (um.messageid = 119 and um.userid = listuser.userid)
where
listmessage.messageid = 119
and listmessage.listid = listuser.listid
and u.id = listuser.userid
and um.userid IS NULL
and u.confirmed and !u.blacklisted and !u.disabled
[0,0030570000] (158)
phpList - Trovati: 1 da elaborare [0,0062110000] (162)
phpList - Invio in corso 119 a xxx@yyy.com [0,0184140000] (173)
phpList - Ho impiegato 0,0534140000 secondi per inviare [0,0598870000] (236)
phpList - Fallito l’invio a xxx@yyy.com [0,0118890000] (239)
phpList - Elaborati 1 di 1 utenti [0,0330320000] (248)
phpList - Script - passo: 5 [0,0186260000] (255)
phpList - 1 fallito (reinvio più tardi) [0,0003610000] (257)
phpList - 1 Messaggi
phpList - 0 num_users_for_message
phpList - 1 batch_count
phpList - 1000 batch_total
phpList - 1 sendemail returned false total
phpList - 0 send blocked by domain throttle
phpList - 1 add attachment error
phpList - 1 sendemail returned false
phpList - 0 sentastest
phpList - 0 invalid
phpList - 1 failed_sent
phpList - 0 Inviati
phpList - 1000 num_per_batch
phpList - 1 Stato
phpList - 0 sent_users_for_message 119
phpList - 1 total_users_for_message 119
phpList - 0 max_users_for_message 119
phpList - 1 processed_users_for_message 119
phpList - 1 failed_sent_for_message 119
phpList - Fine dell’elaborazione [0,0118020000] (314)
(sorry, some lines are in Italian)

root@phplist:/var/www/xxx.yyy.com/web/lists/config#php -v
PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21)
Copyright © 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright © 1998-2016 Zend Technologies
with XCache v3.2.0, Copyright © 2005-2014, by mOo
with Zend OPcache v7.0.6-dev, Copyright © 1999-2016, by Zend Technologies
with XCache Optimizer v3.2.0, Copyright © 2005-2014, by mOo
with XCache Cacher v3.2.0, Copyright © 2005-2014, by mOo
with XCache Coverager v3.2.0, Copyright © 2005-2014, by mOo

apache module
PHP-FPM

uname --all
Linux zzz.yyy.com 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u3 (2017-08-15) x86_64 GNU/Linux

config.php
define(‘TEST’, 0);
define(‘MANUALLY_PROCESS_BOUNCES’, 0);
define(‘ENCRYPTION_ALGO’, ‘sha256’);
define(“ALLOW_ATTACHMENTS”,1);
define(“NUMATTACHMENTS”,1);
define(“FILESYSTEM_ATTACHMENTS”,0);
define(“MIMETYPES_FILE”,"/etc/mime.types");
define(“DEFAULT_MIMETYPE”,“application/octet-stream”);
define(‘EMAILTEXTCREDITS’, 1);
define(‘VERBOSE’, 1);

@aromicreativi There might be an indication of the problem in the event log.

Hi duncanc,

in the end I solved the problem adding an apache config file independent from the ISPConfig panel and with the user www-data. No ISPConfig solution jet, but maybe the independent config is better.

@aromicreativi Yes, you should run the cron jobs under the same user as the web server, such as www-data. Otherwise there are likely to be problems with some file access permissions.