ROUNDCUBE PLUS EMAIL SCHEDULE PLUGIN ==================================== This plugin allows users to schedule the delivery of their email messages. The scheduled messages can be sent with a delay or at a specified date and time. REQUIREMENTS ------------ - PHP: 7.1 or higher - Roundcube: 1.4, 1.5, 1.6 - Database: MySQL / Postgres - System: Cron job - Config: Drafts enabled DISCLAIMER ---------- This plugin initiates email delivery when triggered by a cron job. If the cron job or the plugin are not properly set up, the scheduled emails will not be sent. Please make sure that the plugin works properly before you make it available to your users. If you choose to use it in a production environment, we cannot be held liable for any damages caused by delayed, unsent, or lost email messages. INSTALLATION ------------ 1. Copy the directories xemail_schedule and xframework included in this package to the 'plugins' directory of your Roundcube installation. 2. Rename the file /plugins/xemail_schedule/config.inc.php.dist to config.inc.php. 3. Edit the file /plugins/xemail_schedule/config.inc.php and configure the plugin according to your needs. 4. Create a cron job that will trigger the scheduled email delivery (see the section below.) 5. Edit the file /config/config.inc.php, add xemail_schedule to the plugins array and specify your license key. 6. Make sure drafts_mbox_mbox is not unset in /config/config.inc.php. The plugin needs the draft folder enabled in order to edit the scheduled messages. (Drafts_mbox is enabled by default.) For more information on installing Roundcube Plus plugins see: https://roundcubeplus.com/helpdesk/knowledgebase.php?article=29 COMPATIBILITY / LIMITATIONS --------------------------- 1. This plugin has been created for the standard version of Roundcube as provided on the Roundcube website: https://roundcube.net. It might not work properly with customized versions of Roundcube including the version provided as part of the Kolab system. Please note that we cannot provide any technical support for the plugin deployed on a non-standard version of Roundcube. 2. This plugin is not compatible with the old 'classic' skin. We suggest you remove this skin from your Roundcube installation. 3. This plugin will not work with SQLite because SQLite uses a separate database for each user. In order for the cron script to send the scheduled messages, they need to exist in a common database table. 4. The scheduled emails will only be accessible from within Roundcube; they will not be accessible from any third-party programs that access the imap server directly (for example, Outlook, Thunderbird, etc.) 6. The plugin might not work properly with the enigma plugin. CRON SETUP ---------- In order for the plugin to send the scheduled messages, a cron job must be set up on the server. The cron job must run every minute. Please note that the plugin checks for the existence of a functional cron job and it will disable email scheduling if it does not detect one. There are two ways to set up the cron job: execute a PHP CLI script or access a URL. (The examples below assume you're using a Linux server.) OPTION 1: Execute a PHP script A) Add the following to your cron tab: * * * * * php /plugins/xemail_schedule/cron.php Replace with the absolute directory path of your Roundcube installation. (Under cPanel, Roundcube is usually installed in /usr/local/cpanel/base/3rdparty/roundcube.) Note that the version of PHP running in the command line has a separate configuration from the version running through the web server. You have to make sure that both the versions are set up with the same timezone, or else the messages will be sent at the wrong time. B) Change the permissions of the file /logs/sendmail to 0666 to allow the PHP CLI access to the sendmail log. OPTION 2: Access a URL If you can't use PHP CLI to run the cron script, you can use a URL. Add this to the cron tab: * * * * * wget -O - /index.php?xemail-schedule-cron=1 >/dev/null 2>&1 Replace with the full URL path of your Roundcube installation. Note: This method cannot be used under cPanel because cPanel requires a user to be logged in to access Roundcube. SMTP AUTHENTICATION ------------------- If your cron job runs properly but the messages don't get sent, it might mean that your SMTP server requires authentication. When a user sends a message while being logged in to Roundcube, the user's username and password are sent to the SMTP server along with the email. But when cron is executed, there is no logged in user, so no username and password are available. A possible solution to this problem is to specify a common username and password that will be sent to the SMTP server when sending messages via cron. This can be done in the xemail_schedule config file (look for xemail_schedule_smtp_user and xemail_schedule_smtp_pass.) If you don't know what credentials to use, just create a dummy email account on your server that will be used just for the cron use. Unfortunately some servers will require that the authentication username match the username in the 'from' field of the message that's being sent. If that's the case, you'll see an error in your logs similar to this: 'Sender is not same as SMTP authenticate username.' You may be able to fix this problem in your server's configuration. For example, here's the setting you can use to fix this problem in iRedMail: ALLOWED_LOGIN_MISMATCH_SENDERS = ['user@mydomain.com'] TECHNICAL EXPLANATION --------------------- The scheduled emails are saved in the Roundcube database. A cron job running every minute triggers the plugin's delivery system, which sends the scheduled emails at the right time. Once the emails are sent, their copies are saved in the 'sent' folder of the imap server and removed from the database. (Since the cron job doesn't have access to the individual imap accounts, this copying is done when the user logs in to his or her Roundcube account.) When the user edits a scheduled email, the email is saved as draft on the imap server, removed from the database and edited using the compose page. When the user deletes a scheduled email, the email is saved in the trash folder on the imap server (if enabled) and removed from the database. Please note that we've chosen to save the scheduled emails in the Roundcube database and not on the imap server. This approach is more flexible, safer, and easier to set up, but it introduces two restrictions: 1. Roundcube cannot be set up using SQLite, 2. The scheduled messages cannot be accessed from third-party programs that connect to the imap server directly (Outlook, Thunderbird, etc.) These restrictions are a small price to pay in comparison with the security risks, server constraints, and setup difficulties the admins would face if the scheduled emails were stored directly on the imap server. The plugin would be usable only with selected servers; root access would be required for installation; and an admin account with access to all the accounts on the imap server would be required. We feel that all those constraints would make the plugin practically unusable, that's why we opted for storing the scheduled emails in the database, even if this approach introduces some minor limitations. LICENSE ------- This plugin is distributed under a commercial license. In order to use the plugin, you must purchase the license from Tecorama LLC. See the LICENSE file for details. COPYRIGHT --------- Copyright (c) 2022, Tecorama LLC