PHP code example of bennet0496 / nextcloud_attachments
1. Go to this page and download the library: Download bennet0496/nextcloud_attachments library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bennet0496 / nextcloud_attachments example snippets
// Full URL to the Nextcloud server
// e.g. https://example.com/nextcloud if in subpath
// or https://cloud.example.com if in root
$config["nextcloud_attachment_server"] = "";
// Username resolving strategy from internal Roundcube
// username which usually is the email address e.g. [email protected] or IMAP User
// Placeholders are replaced as following
// %s => verbatim RC username as reported by rcmail->get_user_name(). Depending on config loginuser@domain or login
// %i => username used to login to imap. usually equal to %s (since 1.3)
// %e => user email (since 1.3)
// %l, %u => email localpart (%u is for backward compatibility to <1.3) (since 1.3)
// %d => email domain (since 1.3)
// %h => IMAP Host (since 1.3)
$config["nextcloud_attachment_username"] = "%u";
// Name for the sub folder to upload to
// Defaults to "Mail Attachments"
// Can't be sub folder of sub folder like folder/sub
$config["nextcloud_attachment_folder"] = "Mail Attachments";
// Don't try the email password at all, because we know it won't work
// e.g. due to mandatory 2FA
// Defaults to false, i.e. try the password
// Since version 1.3
$config["nextcloud_attachment_dont_try_mail_password"] = false;
// Message size limit. Note that SMTP server(s) may use a different value.
// This limit is verified when user attaches files to a composed message.
// Size in bytes (possible unit suffix: K, M, G)
$config['max_message_size'] = '25M';
// Limit to show a warning at for large attachments.
// has to be smaller then $config['max_message_size']
// set to null to disable
$config["nextcloud_attachment_softlimit"] = "12M";
// Behavior if $config['max_message_size'] is hit.
// "prompt" to show dialog a la outlook or apple
// "upload" to automatically upload without asking a la google
// Defaults to "prompt"
$config["nextcloud_attachment_behavior"] = "prompt";
// Don't try the email password at all, because we know it won't work
// e.g. due to mandatory 2FA
// Defaults to false, i.e. try the password
// Since version 1.3
$config["nextcloud_attachment_dont_try_mail_password"] = false;