{"id":34017162,"url":"https://github.com/bennet0496/nextcloud_attachments","last_synced_at":"2025-12-13T14:28:09.970Z","repository":{"id":193044694,"uuid":"687991412","full_name":"bennet0496/nextcloud_attachments","owner":"bennet0496","description":"Upload large attachments to Nextcloud and automatically create share link","archived":false,"fork":false,"pushed_at":"2025-08-25T12:24:13.000Z","size":378,"stargazers_count":9,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-28T19:36:05.484Z","etag":null,"topics":["php","roundcube-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bennet0496.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-06T12:30:22.000Z","updated_at":"2025-06-20T16:38:58.000Z","dependencies_parsed_at":"2024-03-20T10:40:30.713Z","dependency_job_id":"30e5bd8d-77bf-406e-a33e-02ee83409f79","html_url":"https://github.com/bennet0496/nextcloud_attachments","commit_stats":null,"previous_names":["bennet0496/nextcloud_attachments"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/bennet0496/nextcloud_attachments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennet0496%2Fnextcloud_attachments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennet0496%2Fnextcloud_attachments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennet0496%2Fnextcloud_attachments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennet0496%2Fnextcloud_attachments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bennet0496","download_url":"https://codeload.github.com/bennet0496/nextcloud_attachments/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennet0496%2Fnextcloud_attachments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27707028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","roundcube-plugin"],"created_at":"2025-12-13T14:28:08.313Z","updated_at":"2025-12-13T14:28:09.961Z","avatar_url":"https://github.com/bennet0496.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nextcloud Attachments for Roundcube\n\nUpload large attachments to Nextcloud and automatically create share link.\nFiles that exceed `$config['max_message_size']`/1.33 will automatically be uploaded to\nthe configured nextcloud server and linked in the email body. If the user has 2FA\nconfigured in Nextcloud, the plugin will ask to log in to create an app password.\n\nThis plugin is meant for environment where users have the same login for \nemail and Nextcloud, e.g. company Installations\n\n![Screenshots](https://github.com/bennet0496/nextcloud_attachments/assets/4955327/c2852c4e-30ca-444c-bf24-172ecc25d75f)\n\n## Config\n\nThe plugin itself has a handful core settings. The server, the username strategy and the sub folder.\n\n```php\n\u003c?php\n// Full URL to the Nextcloud server \n// e.g. https://example.com/nextcloud if in subpath\n// or https://cloud.example.com if in root\n$config[\"nextcloud_attachment_server\"] = \"\";\n\n// Username resolving strategy from internal Roundcube\n// username which usually is the email address e.g. user@example.com or IMAP User\n// Placeholders are replaced as following\n// %s =\u003e verbatim RC username as reported by rcmail-\u003eget_user_name(). Depending on config loginuser@domain or login\n// %i =\u003e username used to log in to imap. usually equal to %s (since 1.3)\n// %e =\u003e user email (since 1.3)\n// %l, %u =\u003e email local part (%u is for backward compatibility to \u003c1.3) (since 1.3)\n// %d =\u003e email domain (since 1.3)\n// %h =\u003e IMAP Host (since 1.3)\n$config[\"nextcloud_attachment_username\"] = \"%u\";\n\n// Name for the sub-folder to upload to\n// Defaults to \"Mail Attachments\"\n// Can't be sub-folder of sub-folder link folder/sub\n//\n// The folder name can also be translated according to the users configured locale\n// by setting the value to a locale-keyed array like\n// [\"en_US\" =\u003e \"Mail Attachments\", \"de_DE\" =\u003e \"E-Mail Anhänge\"]\n// If locale doesn't exist, en_US or first will be used\n$config[\"nextcloud_attachment_folder\"] = \"Mail Attachments\";\n\n// Folder Layout\n// \"flat\"            =\u003e Flat folder layout, everything in the Folder\n// \"date:format\"     =\u003e Create folder hierarchy according to format. See https://unicode-org.github.io/icu/userguide/format_parse/datetime/\n//                      Use \"/\" as the folder separator. Defaults to date:Y/LLLL\n//                      Dateformat is localized\n// \"hash:algo:depth\" =\u003e Use \"algo\"-hash of file, creating sub folder for every of the \"depth\" bytes\n//                      see https://www.php.net/manual/en/function.hash-algos.php\n//                      Defaults to hash:sha1:2\n// Defaults to flat\n$config[\"nextcloud_attachment_folder_layout\"] = \"flat\";\n\n// (Dis)Allow user to change the layout\n// true =\u003e layout is locked, i.e. not user-changeable\n// false =\u003e user may change the layout on their settings page\n$config[\"nextcloud_attachment_folder_layout_locked\"] = true;\n\n// Don't try the email password at all, because we know it won't work\n// e.g. due to mandatory 2FA\n// Defaults to false, i.e. try the password\n// Since version 1.3\n$config[\"nextcloud_attachment_dont_try_mail_password\"] = false;\n\n// Default language to use for the Attached HTML Linking to the file\n// Use a roundcube supported language code.\n// `null` will default to the user display language\n$config[\"nextcloud_attachment_attached_html_lang\"] = null;\n\n// Whether the language to use for the Attached HTML\n// is change able or not.\n// Locking this settings will force the language regardless of\n/// user display settings\n$config[\"nextcloud_attachment_attached_html_lang_locked\"] = false;\n```\nHowever, it also depends on the general config \n\n```php\n// Message size limit. Note that SMTP server(s) may use a different value.\n// This limit is verified when user attaches files to a composed message.\n// Size in bytes (possible unit suffix: K, M, G)\n$config['max_message_size'] = '25M';\n```\nFiles larger than that will/must be uploaded to Nextcloud, so you should set it to\nthe desired value. With the following two additional options you can control the behavior \nof the plugin. Should it behave like Google Mail and automatically without any further \nuser input, or should it behave like Outlook.com with a soft-limit suggesting the user to upload\nand forcing them when the hard limit `$config['max_message_size']` is reached\n\n```php\n// Limit to show a warning at for large attachments.\n// has to be smaller than $config['max_message_size']\n// set to null to disable\n$config[\"nextcloud_attachment_softlimit\"] = \"12M\";\n\n// Behavior if $config['max_message_size'] is hit.\n// \"prompt\" to show dialog a la outlook or apple\n// \"upload\" to automatically upload without asking a la google\n// Defaults to \"prompt\"\n$config[\"nextcloud_attachment_behavior\"] = \"prompt\";\n```\n\nRemember, you will need to modify `post_max_size` and `upload_max_filesize` \nin your `php.ini` to allow large uploads in general\n\n__When enabling the plugin make sure to place it before any other attachment plugins like `filesystem_attachments`__ E.g.\n```php\n$config['plugins'] = array('nextcloud_attachments', /*...*/ 'filesystem_attachments', /*...*/ 'vcard_attachments' /*...*/);\n```\n\n### Nextcloud password policy\nIf you have a password policy governing share-passwords set up in Nextcloud, then you can control the generated password with the\nfollowing parameters\n\n```php\n// Generate Password protected link.\n// Passwords will be included in the message body only, not in the HTML attachment\n// Defaults to false\n$config[\"nextcloud_attachment_password_protected_links\"] = false;\n\n// Allow/Disallow user to change the password protection option for themselves\n// true =\u003e user can not change the setting\n// false =\u003e user may change the setting\n$config[\"nextcloud_attachment_password_protected_links_locked\"] = true;\n\n// Generated password length\n// Passwords will be alphanumerical strings with upper and lower case letters and numbers\n// Defaults to 12\n$config[\"nextcloud_attachment_password_length\"] = 12;\n\n// The alphabets from which to generate password\n// It is guaranteed that at least one character of each set is used,\n// as long as password_length \u003e |password_alphabets|\n// Default: [\"123456789\", \"ABCDEFGHJKLMNPQRSTUVWXYZ\", \"abcdefghijkmnopqrstuvwxyz\"]\n// (Lookalikes are 0O and Il are excluded)\n$config[\"nextcloud_attachment_password_alphabets\"] = [\"123456789\", \"ABCDEFGHJKLMNPQRSTUVWXYZ\", \"abcdefghijkmnopqrstuvwxyz\"];\n```\n\n### Nextcloud Brute-Force protection\nBy default, this plugin, tests whether it can use the mail credentials for the Nextcloud login. If lots of users can't log in with\ntheir mail credentials to Nextcloud, e.g., due to high adoption of 2FA or a high percentage of user that are denied form using\nNextcloud (via LDAP groups or smth), this will inevitably lead to Nextcloud locking out the Roundcube server because it considers\nthese logins, as login bruteforce attempts.\n\nYou can disable the behavior of trying the mail password since version 1.3\n```php\n// Don't try the email password at all, because we know it won't work\n// e.g. due to mandatory 2FA\n// Defaults to false, i.e. try the password\n// Since version 1.3\n$config[\"nextcloud_attachment_dont_try_mail_password\"] = false;\n```\n\nHowever, you might also want to consider, adding you Roundcube server to the Bruteforce allow-list of the Nextcloud server.\nTo do that you have to [enable the bruteforce settings app](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/bruteforce_configuration.html#the-brute-force-settings-app)\nand then as an administrator, under Setting and Security, add your Server's IP to the allow list.\n\n\u003cimg width=\"500\" src=\"https://github.com/bennet0496/nextcloud_attachments/assets/4955327/044fe17d-d400-42ca-b23f-258d8fdd119d\"\u003e\n\n### Excluding users\n\nYou can also exclude users from being able to interact with the plugin, which can be useful if they either won't\nbe able to use the cloud anyway, have a small quota or can't share link or what ever might be the reason, that they\nshould be unable to share file links.\n\nThere are 4 strategies to exclude users. The first and most straight forward one is the direct exclude list\n```php\n$config[\"nextcloud_attachment_exclude_users_in_addr_books\"] = [\"demo@example.com\", \"demouser\"];\n```\nIf either their, IMAP (login) username, email or mapped username matches an entry in the list, they won't be\nable to use the plugin (version \u003c1.3 only matched the login usernames).\n\nThe other 3 strategies (only available in version \u003e=1.3) involve using address books, which essentially allow retrieving \nthe status from LDAP. Which is useful because that has probably the information who can log in where anyway. Option one \nis to exclude any user listed with their uid or email in a given address book, allowing you to create a (hidden) address \nbook that filters the users that should not be able to use the plugin\n```php\n$config[\"nextcloud_attachment_exclude_users_in_addr_books\"] = [\"nocloud\"];\n```\nYou can create a hidden address book by setting its hidden value in the global config.\n```php\n$config['ldap_public']['nocloud'] = array(\n        'name'              =\u003e 'Nextcloud Denylist Book',\n        'hosts'             =\u003e array('ldap.example.com'),\n        'port'              =\u003e 389,\n        'user_specific'     =\u003e false,\n        'base_dn'           =\u003e 'ou=users,dc=example,dc=com',\n        'hidden'            =\u003e true,\n        'filter'            =\u003e '(\u0026(objectClass=posixAccount)(mail=*)(cloudLogin=no))',\n        'search_fields' =\u003e array(\n                'mail',\n                'cn',\n                ),\n        'name_field' =\u003e 'displayName',\n        'email_field' =\u003e 'mail',\n        'vlv' =\u003e true,\n        'sort' =\u003e 'displayName',\n        'fieldmap' =\u003e [\n                 'email' =\u003e 'mail:*',\n                 'uid' =\u003e 'uid'\n        ]\n);\n```\nOption 2 is to exclude users with a specific mapped value in an address book. Allowing you that if you have a public \naddress book anyway to map a value instead of creating a new address book. This is particularly using with directory\nserver supporting the `memberOf` overlay to directly indicate group memberships in the user entry, however currently\nthis may or may not work with multivalued attributes.\n```php\n$config[\"nextcloud_attachment_exclude_users_with_addr_book_value\"] = [[\"public\", \"memberOf\", \"cn=no_cloud,ou=groups,dc=example,dc=com\"]];\n```\nAdd a mapped value with the `fieldset` as shown above.\n\nAnd Option 3 is to exclude users that are in a specific group, when group mapping is set up for the address book.\n```php\n$config[\"nextcloud_attachment_exclude_users_in_addr_book_group\"] = [[\"public\", \"nocloud\"]];\n```\nYou can set up group mapping in the global LDAP config.\n```php\n$config['ldap_public']['public'] = array(\n        'name'              =\u003e 'Public LDAP Addressbook',\n        'hosts'             =\u003e array('ldap.example.com'),\n        'port'              =\u003e 389,\n        'user_specific'     =\u003e false,\n        'base_dn'           =\u003e 'ou=users,dc=example,dc=com',\n        'bind_dn'           =\u003e '',\n        'bind_pass'         =\u003e '',\n        'filter'            =\u003e '(\u0026(objectClass=posixAccount)(mail=*))',\n        'groups'            =\u003e array(\n                'base_dn'         =\u003e 'ou=groups,dc=example,dc=com',     // in this Howto, the same base_dn as for the contacts is used\n                'filter'          =\u003e '(objectClass=posixGroup)',\n                'object_classes'  =\u003e array(\"top\", \"posixGroup\"),\n                'member_attr'     =\u003e 'memberUid',\n                'name_attr'       =\u003e 'cn',\n                'scope'           =\u003e 'sub',\n                ),\n        'search_fields' =\u003e array(\n                'mail',\n                'cn',\n                ),\n        'name_field' =\u003e 'displayName',\n        'email_field' =\u003e 'mail',\n        'vlv' =\u003e true,\n        'sort' =\u003e 'displayName',\n        'fieldmap' =\u003e [\n                    'name'        =\u003e 'displayName',\n                    'surname'     =\u003e 'sn',\n                    'firstname'   =\u003e 'givenName',\n                    'jobtitle'    =\u003e 'loginShell',\n                    'email'       =\u003e 'mail:*',\n                    'phone:home'  =\u003e 'homePhone',\n                    'phone:work'  =\u003e 'telephoneNumber',\n                    'phone:mobile' =\u003e 'mobile',\n                    'phone:pager' =\u003e 'pager',\n                    'phone:workfax' =\u003e 'facsimileTelephoneNumber',\n                    'street'      =\u003e 'street',\n                    'zipcode'     =\u003e 'postalCode',\n                    'region'      =\u003e 'st',\n                    'locality'    =\u003e 'l',\n                    // if you country is a complex object, you need to configure 'sub_fields' below\n                    'country'      =\u003e 'c',\n                    'organization' =\u003e 'o',\n                    'department'   =\u003e 'ou',\n                    'notes'        =\u003e 'description',\n                    'photo'        =\u003e 'jpegPhoto',\n                    // these currently don't work:\n                    // 'manager'       =\u003e 'manager',\n                    // 'assistant'     =\u003e 'secretary',\n                    'uid' =\u003e 'uid'\n        ]\n);\n```\n\n## Planned Features\n - [ ] Give the option for (additional) user specific Nextcloud servers\n - [ ] Wrap WebDAV request for easier adaptation to other Servers\n - [ ] Allow to define global user\n - [x] Translatable attachment template\n - [ ] Translate to more languages\n   - Contribute in [transifex](https://explore.transifex.com/icarus7/nextcloud_attachments/)\n - [x] Add folder to `sync-exclude.lst` to prevent desktop clients from (automatically) downloading the folder\n\n## Credits\n\n- Icons for Attachment body\n  - [Ubuntu Yaru](https://github.com/ubuntu/yaru) (CC BY-SA 4.0) \n  - [Material Icons](https://developers.google.com/fonts/docs/material_icons) (Apache License 2.0)\n- HTTP library: [Guzzle HTTP](https://github.com/guzzle/guzzle) (MIT)\n- Loading Animation: [decode](https://dev.to/dcodeyt/create-a-button-with-a-loading-spinner-in-html-css-1c0h)\n- HTML minimization: [StackOverflow](https://stackoverflow.com/a/6225706)\n- Russian Translation: [@Sanmen87](https://github.com/Sanmen87)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennet0496%2Fnextcloud_attachments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbennet0496%2Fnextcloud_attachments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennet0496%2Fnextcloud_attachments/lists"}