Installazione configurazione di PhpList: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
Line 84: Line 84:
* Creare una casella email POP3
* Creare una casella email POP3
  bounce@domain.dom
  bounce@domain.dom
===Utilizzo di casella gmail per l'invio===
* '''ATTENZIONE: se si utilizza l'smtp di gmail per inviare le newsletter, questod i default sovrascrive il retur-path conq uello della casella from. Occorre abilitare la casella gmail ad inviare anche con l'indirizzo di bounce.'''
* Abilitare l'uso delle 'less secure apps' (*[http://kb.mozillazine.org/Using_Gmail_with_Thunderbird_and_Mozilla_Suite Gmail - MozillaZine Knowledge Base])


* Dichiarare l'indirizzo della casella nel config file
* Dichiarare l'indirizzo della casella nel config file

Revision as of 14:09, 28 March 2017

Installazione

Prelevare il pacchetto:

http://sourceforge.net/projects/phplist/files/

Scompattare nel folder phplist SOLO i files contenuti nella cartella lists


Configurazione

Modificare il file di configurazione

sudoedit config/config.php
$language_module = "italian.inc"; (per impostare la lingua italiana nella parte frontend)
$database_host = "localhost"; (dove risiede il database mySQL)
$database_name = "phplist"; (il nome del database, nel nostro caso phplist)
$database_user = "admin"; (il nome del db user, nel nostro caso admin)
$database_password = 'phplistpassword'; (la pwd del db user, nel nostro caso phplistpassword)
$pageroot = '/phplist';
$adminpages = '/phplist/admin';

Impostare la lingua di amministrazione:

sudoedit admin/languages.php
"it"=>array("Italian "," iso-8859-1, windows-1252 "),

oppure

"it"=>array("Italian","utf-8","utf-8"),

Per la versione 2.10.12, se il database è UTF8, bisogna patchare un file, altrimenti esce l'errore:

Inizializzazione tabella user_blacklist_data
Database error 1071 while doing query Specified key was too long; max key length is 1000 bytes
cd admin
cat | sudo patch -p0 structure.php <<EOFile
72c72
<         "index_2" => array("emailnameidx (email,name)",""),
---
>         "index_2" => array("emailnameidx (email(233),name)",""),
EOFile
cd ..


  • Lanciare l'installazione:

http://servername/phplist/admin

  • Accedere all'interfaccia di amministrazione

http://servername/phplist/admin

utilizzando

username: admin

password: phplist

  • Verificare il database:
http://sitename/phplist/admin/?page=dbcheck

Proseguire con la configurazione:

sudoedit config/config.php
define('CLICKTRACK',1);
define('CLICKTRACK_SHOWDETAIL',1);
define('USE_DOMAIN_THROTTLE',1);
define("PHPMAILERHOST",'localhost');

Per altri settaggi, consultare http://docs.phplist.com/PhpListConfiguration

Gestione dei bounce

  • Creare una casella email POP3
bounce@domain.dom

Utilizzo di casella gmail per l'invio

  • ATTENZIONE: se si utilizza l'smtp di gmail per inviare le newsletter, questod i default sovrascrive il retur-path conq uello della casella from. Occorre abilitare la casella gmail ad inviare anche con l'indirizzo di bounce.
  • Abilitare l'uso delle 'less secure apps' (*Gmail - MozillaZine Knowledge Base)


  • Dichiarare l'indirizzo della casella nel config file
sudoedit config/config.php
$message_envelope = "mybounces@yourdomain.com";
  • Definire i dettagli della casella creata
$bounce_mailbox_host       = 'host.dom';
$bounce_mailbox_user       = 'bounces@domain.com';
$bounce_mailbox_password   = 'super-secret';
  • Definire se si usa SSL con un certificato self signed:
$bounce_mailbox_port = "995/pop3/ssl/novalidate-cert";
  • Per altri dettagli, consultare:

http://docs.phplist.com/PhpListConfigBounces

  • Per il formato del parametro bounce_mailbox_port vedere:

http://www.php.net/manual/en/function.imap-open.php

Abilitazione upload immagini

PER UPLOAD ANCHE PDF E FLASH E ALTRI FILES:

Per allegare pdf'


  • Creare la directory e settare le permission
sudo mkdir uploadimages/
sudo chown www-data: uploadimages/
sudo chmod g+w uploadimages/
  • Applicare il seguente patch al file
admin/FCKeditor/editor/filemanager/connectors/phplist/config.php
cat > /tmp/config.php.diff << 'EOFile'
--- config.php  2010-04-23 15:05:55.000000000 +0000
+++ /var/www/rvmgroup.it/www/html/phplist/admin/FCKeditor/editor/filemanager/connectors/phplist/config.php      2010-12-17 17:38:44.000000000 +0000
@@ -25,8 +25,8 @@
 global $Config ;
 if (isset($_SERVER["ConfigFile"]) && is_file($_SERVER["ConfigFile"])) {
   include $_SERVER["ConfigFile"];
-} elseif (is_file('../../../../../../../../config/config.php')) {
-  include "../../../../../../../../config/config.php";
+} elseif (is_file('../../../../../../config/config.php')) {
+  include "../../../../../../config/config.php";
 } else {
   SendError( 1, 'unable to load phplist config file' );
   print "Error, cannot find config file\n";
@@ -46,7 +46,7 @@
   if (!preg_match('#/$#',$GLOBALS["pageroot"])) {
     $GLOBALS["pageroot"] = $GLOBALS["pageroot"] . '/';
   }
-  $Config['UserFilesPath'] = $GLOBALS["pageroot"].FCKIMAGES_DIR.'/' ;
+  $Config['UserFilesPath'] = 'http://'.$_SERVER['HTTP_HOST'].$GLOBALS["pageroot"].FCKIMAGES_DIR.'/' ;
 }
 
 // SECURITY: You must explicitly enable this "connector". (Set it to "true").
@@ -57,7 +57,7 @@
 // user files directory. Useful if you are using a virtual directory, symbolic
 // link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
 // Attention: The above 'UserFilesPath' must point to the same directory.
-$Config['UserFilesAbsolutePath'] = '' ;
+$Config['UserFilesAbsolutePath'] = $_SERVER['DOCUMENT_ROOT'].$GLOBALS['pageroot'].FCKIMAGES_DIR.'/';
 
 // Due to security issues with Apache modules, it is recommended to leave the
 // following setting enabled.
@@ -82,11 +82,11 @@
 // If possible, it is recommended to set more restrictive permissions, like 0755.
 // Set to 0 to disable this feature.
 // Note: not needed on Windows-based servers.
-$Config['ChmodOnUpload'] = 0777 ;
+$Config['ChmodOnUpload'] = 0644 ;
 
 // See comments above.
 // Used when creating folders that does not exist.
-$Config['ChmodOnFolderCreate'] = 0777 ;
+$Config['ChmodOnFolderCreate'] = 0755 ;
 
 /*
        Configuration settings for each Resource Type
@@ -144,28 +144,28 @@
 $Config['DeniedExtensions']['File']            = array() ;
 $Config['FileTypesPath']['File']               = $Config['UserFilesPath'] . 'file/' ;
 $Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
-$Config['QuickUploadPath']['File']             = $Config['UserFilesPath'] ;
-$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
+$Config['QuickUploadPath']['File']             = $Config['FilesTypesPath'][File] ;
+$Config['QuickUploadAbsolutePath']['File']= $Config['FilesTypesAbsolutePath'][File] ;
 
 $Config['AllowedExtensions']['Image']  = array('bmp','gif','jpeg','jpg','png') ;
 $Config['DeniedExtensions']['Image']   = array() ;
 $Config['FileTypesPath']['Image']              = $Config['UserFilesPath'] . 'image/' ;
 $Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
-$Config['QuickUploadPath']['Image']            = $Config['UserFilesPath'] ;
-$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
+$Config['QuickUploadPath']['Image']            = $Config['FilesTypesPath'][Image] ;
+$Config['QuickUploadAbsolutePath']['Image']= $Config['FilesiTypesAbsolutePath'][Image] ;
 
 $Config['AllowedExtensions']['Flash']  = array('swf','flv') ;
 $Config['DeniedExtensions']['Flash']   = array() ;
 $Config['FileTypesPath']['Flash']              = $Config['UserFilesPath'] . 'flash/' ;
 $Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
-$Config['QuickUploadPath']['Flash']            = $Config['UserFilesPath'] ;
-$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
+$Config['QuickUploadPath']['Flash']            = $Config['FilesTypesPath'][Flash] ;
+$Config['QuickUploadAbsolutePath']['Flash']= $Config['FilesTypesAbsolutePath'][Flash] ;
 
 $Config['AllowedExtensions']['Media']  = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv') ;
 $Config['DeniedExtensions']['Media']   = array() ;
 $Config['FileTypesPath']['Media']              = $Config['UserFilesPath'] . 'media/' ;
 $Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
-$Config['QuickUploadPath']['Media']            = $Config['UserFilesPath'] ;
-$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
+$Config['QuickUploadPath']['Media']            = $Config['FilesTypesPath'][Media] ;
+$Config['QuickUploadAbsolutePath']['Media']= $Config['FilesTypesAbsolutePath'][Media] ;
 
 ?>
EOFile
echo "bb0efa5ac152dcf20fdf43566c650bfe  /tmp/config.php.diff" | md5sum --check


  • Creare il seguente file .htaccess (forse non serve):
cat | sudo tee admin/FCKeditor/editor/filemanager/.htaccess <<EOFile
<FilesMatch "\.(php)$">
Order allow,deny
allow from all
</FilesMatch>
EOFile

Per altri dettagli, consultare:

http://docs.phplist.com/UsingFCKEditor

Installazione cron job per gestione code e bounce

  • È necessario configurare un cron job per processare regolarmente la coda messaggi, altrimenti se rimangono dei messaggi non inviati, questi rimarranno in giacenza fino al prossimo processamento della coda
sudoedit -u nobody phplist-cron
#!/bin/bash

# script to run PHPlist from commandline. You may need to edit this to make it
# work with your shell environment. The following should work for Bash on
# Fedora Linux but this may vary strongly in other situations. You will need to
# dig into the code to make sure it works for you.

# in commandline mode, access is restricted to users who are listed in the
# config file check README.commandline for more info

# identify the config file for your installation
PHPLISTPATH="/var/www/rvmgroup.it/www/html/phplist"
CONFIG="${PHPLISTPATH}/config.php"
export CONFIG

# alternatively you can use -c <path to config file> on the commandline

# run the PHPlist index file with all parameters passed to this script
/usr/bin/php ${PHPLISTPATH}/admin/index.php $*
  • Renderlo eseguibile
 sudo -u nobody chmod +x phplist-cron
  • Creare il cron job
sudoedit /etc/cron.d/process-phplist 
#=================================================================
# CRON JOB FOR COMMAND LINE SCRIPT "phplist"
# (PHP-cli required)
# My config.php file has:
#   $commandline_users = array("user1","user2","user3");
#   define("MAILQUEUE_BATCH_SIZE",200);
#   define("MAILQUEUE_BATCH_PERIOD",3600);
#   define('MAILQUEUE_THROTTLE',5);
#
#  Every hour at 15 minutes past, we process the queued messages.
#  Every day at 1.10 am, we process bounces.
#=================================================================
MAILTO="listreports@example.com"
USER="www-data"
PHPLISTPATH="/var/www/example.com/www/html/phplist"

#m      h       dom     mon     dow     user            command
15,30   *       *               *               *               www-data      $PHPLISTPATH/phplist-cron -pprocessqueue > /dev/null
10      1       *               *               *               www-data       $PHPLISTPATH/phplist-cron -pprocessbounces > /dev/null
  • Abitlitare l'utente www-data ad eseguire lo script via commandline
sudoedit config/config.php 
$commandline_users = array("www-data");
  • Provare lo script
sudo -u www-data /var/www/example.com/www/html/phplist/phplist-cron -pprocessqueue

Riferimenti

Utilizzo

http://docs.phplist.com/SettingUpForUse


  • Have you setup an "abuse@mydomain.com" account? (This helps recipients' email systems know you aren't a spammer)
  • Have you setup a "postmaster@mydomain.com" account? (Ditto.)

Disabilitare la modalità di test:

define ("TEST",0); (originariamente è impostato ad 1)
  • Test per vedere se la newsletter viene considerata spam SpamCheck

Riferimenti