WebMail Pro documentation

Using Amazon or DigitalOcean S3 instead of local file storage

By default, Files module of WebMail Pro stores personal files directly on the webserver, under data/files/ directory.

You can replace local storage with S3 compatible remote storage like AWS or DigitalOcean.

To activate personal S3 filestorage, you need to disable local personal files module, by setting Disabled to true in data/settings/modules/PersonalFiles.config.json configuration file.

Then set Disabled to false in data/settings/modules/S3Filestorage.config.json file. In that file, you also need to supply connection details and bucket name - you can do that via admin interface as well:

S3 Filestorage

Most of these parameters are obtained from Amazon S3 or DigitalOcean control interfaces.

In case of Amazon S3, you obtain Access key and Secret key from IAM console, as shown here. Instead of using your root account, it's strongly recommended to create an administrator user via IAM console, and upon creating such a user and adding them to Administrators group, you'll be issued with Access key and Secret key.

You will also need to specify your region ID and a hostname used. Example of the region ID used is us-east-2, you can find the complete list of regions here. As for Host, it's set to empty string in case of Amazon S3.

For DigitalOcean, you need to create a Space as described here, with a particular region selected, then you can generate Access key and Secret key there as well.

NB: In case of DigitalOcean, you always set region to us-east-1, the actual DO region (fra1, sfo2 etc.) is supplied as a part of hostname, for example fra1.digitaloceanspaces.com. Samples found here show typical use of DigitalOcean Spaces connection parameters.

As for bucket prefix name, that's an optional identifier you can provide yourself, it's not obtained from any of the services, but a unique prefix which will be used for buckets created.

Additionally, if you wish to use S3 storage for corporate files, set Disabled to true in data/settings/modules/CorporateFiles.config.json file, then set Disabled to false in data/settings/modules/S3CorporateFilestorage.config.json file.

Corporate module that uses S3 filestorage doesn't have its own connection settings, it takes those from S3 filestorage module, so enabling corporate S3 module requires configuring personal one.

NB: By default, obtaining files on S3 storage is done via redirect to their actual URLs. If that behavior is causing issues, e.g. when you access your WebMail Pro installation via https and get certificate-related warnings, set "RedirectToOriginalFileURLs" to false in data/settings/modules/S3Filestorage.config.json configuration file (the option is added in v9.3).

It is assumed that bucket URL is obtained using subdomains, for example:

https://bucket-name.s3.region-code.amazonaws.com/key-name

This is how it works by default at AWS and DigitalOcean. There's also an alternative path-style URL syntax:

https://s3.region-code.amazonaws.com/bucket-name/key-name

It may be especially useful in case of self-hosted S3 storages. To switch to this syntax, set "UsePathStyleEndpoint" to true in data/settings/modules/S3Filestorage.config.json file.