E-mail notification system

Configuration

To be able to send e-mails from Web File Share, you need to either have PHP configured with “sendmail” or have Web File Share configured with an SMTP server. Do note that most SMTP servers require authentication, and to prevent spam and other attacks, some don't even allow you to send e-mails from other addresses than the one configured for authentication. So don't be surprised if you are trying to send a file from a particular e-mail address and the recipient sees the message as coming from the address you used for the SMTP authentication.

Web File Share tries to detect your SMTP server configuration and in some cases will use STARTTLS even if you don't want to. If that is the case, the solution is to open the file customizables/config.php (create the file if it doesn't exist) in a text editor and edit it too look like this:

<?php $config['system']['email']['smtp_options'] = ['SMTPAutoTLS' => false, 'ssl' => ['verify_peer' => false, 'verify_peer_name' =>false,'allow_self_signed' => true]];

Introduction

There are three ways you can configure Web File Share to send e-mail notifications:

(1) Admin users can enable or disable the “Notifications” checkbox for the users, when they create or edit their accounts. In this case the users will receive e-mail notification messages when files are upload or downloaded from their folders or when comments are attached to their files, or when other users share folders with them. The users also have control over this option and they can enable/disable from their “Account settings” panel. One requirement from e-mail notifications to be sent on other users action is the permission to “see and exchange files with”. This is set from the control panel, under the “Permissions” tab, when editing a user account. If user A isn't aware of the existence of user B, user A will not be notified if user B makes changes inside user A's folders.

(2) Admin users can also use the “Control Panel » Notifications” section for setting up rules for notifications. Here you manually select which user-performed actions should send e-mail notifications. Using this option you can configure e-mail notifications to be sent to different e-mail addresses than the ones set for the user accounts.

(3) With the Enterprise Web File Share version, users can choose to be notified when certain actions are being performed in a particular folder, by right-clicking the folder and selecting the “Notifications” option. The users can choose to be notified only about “write” actions or “read” actions. This option allows the users to receive notifications about “write” actions performed in folders that do not belong to them, but have been shared by other users, so the users can get notified when new files are available in these folders.

By default the e-mail notifications messages are sent from the e-mail address “[email protected]”. We recommend you to change that (from “Control Panel » System configuration » E-mail settings”) as many e-mail servers do not process messages that come from addresses that use a different domain name then the one used to host the Web File Share installation. In most cases this e-mail address needs to be associated with a valid e-mail account.

Customizing the notification messages

There are more than 70 actions that Web File Share can monitor in order to send e-mail notifications. Each action can have its own e-mail body template. For each action there is a corresponding template file, located inside the folder “customizables/emails/“. For the actions that do not have a template file, the template “customizables/emails/generic.tpl.txt” will be automatically used.

The following information which applies to all outgoing notifications can be customized from the control panel, under “System configuration”, “E-mail”, “Settings”:

  • From e-mail address
  • An optional BCC (Blind carbon copy) e-mail address
  • E-mail subject
  • Body content

E-mail template file format


 
<Action>
 [...]
 User "{$info.userInfo.name}" has performed the following action: "{$info.details.action}
 [...]
</Action>

 

The XML tags (<Action>, <From>, <Subject>, etc…) should not be altered or removed from the template files.

The body of the notifications contains Smarty syntax that allows you to use variables and perform various logical operations. For more details on using Smarty, please check this page: http://www.smarty.net/docs/en/smarty.for.designers.tpl

The following Smarty variables are available for use inside the templates:

{$info.userInfo.username}

User’s login name.

{$info.userInfo.name}

User’s name.

{$info.userInfo.company}

Company name

{$info.userInfo.website}

User’s website address.

{$info.userInfo.description}

User’s admin note.

{$info.config.url.root}

The URL of the Quik File Share installation.

{$info.settings}

Array containing Quik File Share’s current settings.

{$info.details}

Array containing details related to the performed action.

The structure varies according to each specific action.

 

Adding an email notification template

Each action has a unique keyname. Here are two examples:

  • “upload” for “When a file gets uploaded.”
  • “download” for “When a file gets downloaded”).

(You can check the following table for a full list of keynames.)

To add a custom template for a certain action, a text file named ”keyname.tpl.txt“ should be created in the e-mail notifications templates folder (as pointed above).

 

Actions keynames


 

Used often

 

upload

File uploaded

receive_upload

File received (via upload)

receive_copy

File received (via copy)

receive_move

File received (via move)

download

File downloaded

provide_download

File downloaded by other user

weblink_access

WebLink folder access

weblink_download

WebLink download

weblink_upload

File received (via WebLink)

shared_folder_available

New shared folder available

comment_added

File comment added

comment_received

Comment received on a file from other user

metadata_changed

Metadata information changed for a file

login

Login

folder_shared

Folder shared

weblink_create

WebLink created

file_encrypted

File encrypted

file_decrypted

File decrypted

Rarely used

 

weblink_update

WebLink modified

weblink_remove

WebLink removed

logout

Logout

login_failed

Login failed

login_failed_account_deactivated

Account deactivated

password_changed

Password changed

user_manually_activated

Account activated by admin user

user_manually_deactivated

Account deactivated by admin user

comment_removed

File comment removed

folder_unshared

Folder unshared

Successful file actions

 

file_moved

File moved

file_copied

File copied

file_deleted

File deleted

deleted_file_restored

Restored deleted file

trash_delete_file

File permanently deleted

file_renamed

File renamed

zip_files

Files zipped

files_send_by_email

Files sent by email

file_locked

File locked

file_unlocked

File unlocked

version_restored

File version restored

version_deleted

File version deleted

Successful folder actions

 

new_folder

New folder created

folder_moved

Folder moved

folder_deleted

Folder deleted

deleted_folder_restored

Restored deleted folder

trash_delete_folder

Folder permanently deleted

folder_renamed

Folder renamed

folder_copied

Folder copied

zip_folder

Folder zipped

Failed file actions

 

upload_failed

Upload failed

file_copy_failed

Failed to copy file

file_deletion_failed

Failed to delete file

file_move_failed

Failed to move file

failed_file_rename

Failed to rename file

zip_files_failed

Failed to zip files

files_send_by_email_failed

Failed to send files by email

file_lock_failed

Failed to lock file

file_unlock_failed

Failed to unlock file

failed_to_add_comment

Failed to add comment to file

failed_to_remove_comment

Failed to remove comment from file

version_restoration_failed

Failed to restore file version

version_deletion_failed

Failed to delete file version

Failed folder actions

 

new_folder_failed

Failed to create new folder

failed_folder_rename

Failed to rename folder

folder_copy_failed

Failed to copy folder

folder_deletion_failed

Failed to delete folder

folder_move_failed

Failed to move folder

zip_folder_failed

Failed to zip folder

Misc

 

new_user_registration

New user registration

password_changed

Password changed

password_recovery

Password recovery

Administrative

 

user_added

User added

user_edited

User edited

user_deleted

User deleted

role_added

Role added

role_edited

Role edited

role_deleted

Role deleted

space_quota_warning

Space quota usage warning

Grouping notifications

You can configure Web File Share to send all the notifications for a certain time period in a single e-mail message. This helps preventing Web File Share from sending hundreds of e-mail messages at a time, when users are uploading many files in a short time span.

To enable this you need to uncheck the option ”Instant email notifications“ available in “Control Panel” » “System configuration” » “E-mail settings”. The notifications will no longer be sent instantly, but queued until you run the script “cron/email_notifications.php” from the command line. On most Linux servers the command looks like this:

php cron/email_notifications.php your.server.hostname.com

In some cases, where you have a custom “php.ini” PHP configuration file for the Web File Share installation folder you might need to specify the path to it, so that the command is executed with the same configuration and not the default one (which usually doesn't load needed extensions, such as ionCube):

php -c php.ini cron/email_notifications.php your.server.hostname.com

Using a Cron job on Linux servers or a scheduled task on Windows, you can choose the time interval the e-mail notifications are getting sent.

You can read more about cron here: http://en.wikipedia.org/wiki/Cron For examples, see this page: http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

If you are using a web hosting service, you most probably have a control panel tool for setting up scheduled tasks, so we recommend you to ask your server administrator or hosting service tech support how do you go about setting this up.

Attached Files
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Name
Email
Security Code Security Code
Related Articles RSS Feed
Time zone
Viewed 1291 times since Wed, Mar 5, 2014
File preview
Viewed 3150 times since Wed, Mar 5, 2014
MENU