One of the limitations of phpList is that you have to use the web interface to compose your messages. Some users may prefer to compose their message using their regular e-mail client or pass on a forwarded message to their list.
There is a phpList hack which implements this functionality. It's described at http://docs.phplist.com/MailToList.
To install the MailToList
hack, download the latest version (linked to the wiki page, and included with this book) and extract the contents. Copy m2l_cron.php
to the root of your publicly-accessible phpList directory, and copy the mailtolist.php
and the plugins/mailtolist
folder into your admin/plugins
directory, retaining the folder structure.
Your plugins
folder will now look something like this:
drwxr-xr-x 2 root root 4096 Apr 24 2010 defaultplugin -rw-r--r-- 1 root root 265 Apr 27 2006 helloworld.php drwxr-xr-x 2 root root 4096 Dec 5 18:18 mailtolist -rw-r--r-- 1 root root 507 Feb 14 2007 mailtolist.php drwxr-xr-x 2 root root 4096 Apr 24 2010 sidebar -rw-r--r-- 1 root root 241 Apr 27 2006 sidebar.php
Open admin/plugins/mailtolist/get_email.class.php
and look for the following line (around line #30):
var $attach_url = "http://www.yourdomain.com/mailinglist/attachments/";
Change the value of $attach_url
to the URL which users would use to view your attachments directory, if you have one.
Then look for the following line (around line #34):
var $file_path = "C:/wamp/www/phplist test/lists/tmp/";
Change the value of $file_path
to the filesystem path to your attachments directory (the same as $attachment_repository
in config/config.php)
.
Now open config/config.php
and look for the following line:
define("PLUGIN_ROOTDIR","/home/me/phplistplugins");
Change this to:
define("PLUGIN_ROOTDIR","plugins");
Reload the administration web interface. At the bottom of the right-hand sidebar, you'll see new links for the plugins we've enabled. Click on mail to list:
The first time you click on mail to list, the plugin will update your database structure to add its own tables. Click on Click to reload to load the "normal" interface you'll see from now on:
Click on Configure Mail To List to start the configuration process. For each list to be configured for Mail To List processing, select the list in the drop-down box and click on the Edit list button:
For each list, you'll need an independent e-mail address with which to receive incoming messages. Configure your e-mail address, mail box details, and whether or not you want to automatically place incoming messages in the message queue (that is, you may want to manually review them first). Click on Apply settings to save:
Note that you won't be directed back to the main configuration page—you'll need to re-navigate to this page using the sidebar.
Of course, you don't want just anybody to be able to send e-mails to your list (imagine receiving a spam message and having it re-broadcasted to your trusting subscribers!). To this end, you'll need to "whitelist" trusted e-mail addresses. Click on the Edit users button on the main configuration page to whitelist users:
If you have a large subscriber base and you want several users to be able to create messages by e-mail, it may be impractical to whitelist them one-by-one. Click on the Import users button to begin importing existing list members:
Select the list from which you want to import users and click on Import.
Send an e-mail to the configured address from a whitelisted e-mail account and then click on the Process new mails button:
Note that due to a bug in the code, if there is only a single message to be processed, it will not be reflected as having been successful even though it was (that is, Processed message 1 of 1 still means that a message was successfully processed):
When you run process queue the next time, the message will be delivered as per usual.
While sending an e-mail to phpList via your e-mail client is very convenient, if you still have to login to manually process the incoming mail box, then you're not saving much time or effort.
Let's automate the processing of this mail box using the ml2_cron.php
file, which you've saved into the root of your phpList folder upon installation earlier.
Using whatever cron-based task scheduling interface you have at your disposal (either via the command line or a web control panel), schedule the running of this file via the PHP CLI binary. That is, if your version is saved in /home/mywebuser/public_html/lists/ml2_cron.php
and your PHP binary is /usr/bin/php
, then set up a cron task (at whatever frequency you prefer) to execute /usr/bin/php /home/mywebuser/public_html/lists/ml2_cron.php
.
The output of this command will look just like it does in the web interface, except it will be displayed in HTML code, like this:
<h1>Mail to List Processing page </h1><p>Mail to List is trying to process all the new messages</p><br /><br />______________________________________________<br /><br />Processing list <b>'myfans'</b><br />-------------------------------<br /><br />Status of pop3 connection: <font color='red'><b>Connected</b><br /></font><br /><br />Processed message <b>1</b> of <b>1</b><br />No e-mails where sent to <b>[email protected]</b>.
Combining cron automation with phpList's processqueue
automation will, therefore, give you the potential to send messages to your subscribers without having to use the web interface at all.
At the time of writing, the latest version of mailtolist
is 2.0.0b. This version suffers from a few bugs which will hopefully be addressed by the developer in future releases. Two such bugs are the following.
Due to either a flaw in the plugin logic or to changes to recent versions of phpList, if you use your e-mail client to send a message in plain text format, it will be delivered to your subscribers with no content and only the default footer. To work around this, always send your messages in HTML format.
3.138.36.38