├── icon.png ├── localization ├── en_US.inc ├── fr_FR.inc ├── ru_RU.inc ├── pt_BR.inc └── es_ES.inc ├── easy_unsubscribe.js ├── composer.json ├── README.md ├── LICENSE ├── easy_unsubscribe.php └── easy_unsubscribe.css /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Neoboffin/roundcube-easy-unsubscribe/HEAD/icon.png -------------------------------------------------------------------------------- /localization/en_US.inc: -------------------------------------------------------------------------------- 1 | =0.1.6" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Roundcube Easy Unsubscribe 2 | Displays a small icon after the subject line when viewing an email, so you can very quickly unsubscribe. Multiple icons may show as the plugin is reliant upon the `List-Unsubscribe` header. Sometimes emails use multiple i.e. one mailto: and one URL. 3 | 4 | 5 | ## Demo Visual 6 | ![Demo SS](https://i.ibb.co/58B3P57/Screenshot-2023-11-29-at-12-42-46-PM.png) 7 | 8 | ## Deployment 9 | 10 | Download a copy of this repo and upload the contents to: 11 | ``` 12 | /path/to/roundcube/plugins/easy_unsubscribe 13 | ``` 14 | 15 | Edit your `/path/to/roundcube/config/config.inc.php` file and add `easy_unsubscribe` to the `$config['plugins']` variable. It should look something like the following: 16 | 17 | ``` 18 | $config['plugins'] = array( 19 | 'password', 20 | 'easy_unsubscribe' 21 | ); 22 | ``` 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Steven Sullivan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /easy_unsubscribe.php: -------------------------------------------------------------------------------- 1 | config->get('layout'); 13 | 14 | $this->add_hook('message_headers_output', array($this, 'message_headers')); 15 | $this->add_hook('storage_init', array($this, 'storage_init')); 16 | 17 | $this->include_stylesheet('easy_unsubscribe.css'); 18 | $this->include_script('easy_unsubscribe.js'); 19 | 20 | $this->add_texts('localization/'); 21 | 22 | $rcmail->output->add_label('easy_unsubscribe.confirm'); 23 | 24 | } 25 | 26 | public function storage_init($p) { 27 | 28 | if(isset($p['fetch_headers'])) $p['fetch_headers'] = trim($p['fetch_headers'] . ' ' . strtoupper('List-Unsubscribe')); 29 | return $p; 30 | 31 | } 32 | 33 | public function message_headers($p) { 34 | 35 | if($this->message_headers_done===false) { 36 | 37 | $this->message_headers_done = true; 38 | if(!isset($p['headers']->others['list-unsubscribe'])) return $p; 39 | 40 | $ListUnsubscribe = $p['headers']->others['list-unsubscribe']; 41 | 42 | if (preg_match_all('/<(.+)>/mU', $ListUnsubscribe, $items, PREG_PATTERN_ORDER)) { 43 | 44 | foreach ( $items[1] as $uri ) { 45 | 46 | $this->unsubscribe_img .= '' . $this->gettext('unsubscribe') . ''; 47 | 48 | } 49 | } 50 | 51 | } 52 | 53 | if(isset($p['output']['subject'])) { 54 | 55 | $p['output']['subject']['value'] = $p['output']['subject']['value'] . $this->unsubscribe_img; 56 | $p['output']['subject']['html'] = 1; 57 | 58 | } 59 | 60 | return $p; 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /easy_unsubscribe.css: -------------------------------------------------------------------------------- 1 | .easy_unsubscribe_link img { height: 13px; margin-left: 10px; vertical-align: middle; opacity: 0.5; transition:all 0.3s ease; } 2 | .easy_unsubscribe_link:hover img { opacity:1; } 3 | 4 | /** 5 | * Tooltip Styles 6 | */ 7 | 8 | .tooltip,[data-tooltip]{position:relative;cursor:pointer}.tooltip:after,.tooltip:before,[data-tooltip]:after,[data-tooltip]:before{position:absolute;visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .2s ease-in-out,visibility .2s ease-in-out,-webkit-transform .2s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .2s ease-in-out,visibility .2s ease-in-out,-moz-transform .2s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .2s ease-in-out,visibility .2s ease-in-out,transform .2s cubic-bezier(.71,1.7,.77,1.24);-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translate3d(0,0,0);pointer-events:none}.tooltip:focus:after,.tooltip:focus:before,.tooltip:hover:after,.tooltip:hover:before,[data-tooltip]:focus:after,[data-tooltip]:focus:before,[data-tooltip]:hover:after,[data-tooltip]:hover:before{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:alpha(Opacity=100);opacity:1}.tooltip:before,[data-tooltip]:before{z-index:1001;border:6px solid transparent;background:0 0;content:""}.tooltip:after,[data-tooltip]:after{z-index:1000;padding:5px 10px;width:160px;background-color:#000;background-color:hsla(0,0%,20%,.9);color:#fff;content:attr(data-tooltip);font-size:11px;line-height:11px}.tooltip-top:after,.tooltip-top:before,.tooltip:after,.tooltip:before,[data-tooltip]:after,[data-tooltip]:before{bottom:100%;left:50%}.tooltip-top:before,.tooltip:before,[data-tooltip]:before{margin-left:-6px;margin-bottom:-12px;border-top-color:#000;border-top-color:hsla(0,0%,20%,.9)}.tooltip-right:after,.tooltip-right:before{bottom:50%;left:100%}.tooltip-right:before{margin-bottom:0;margin-left:-12px;border-top-color:transparent;border-right-color:#000;border-right-color:hsla(0,0%,20%,.9)}.tooltip-right:focus:after,.tooltip-right:focus:before,.tooltip-right:hover:after,.tooltip-right:hover:before{-webkit-transform:translateX(12px);-moz-transform:translateX(12px);transform:translateX(12px)}.tooltip-left:before,.tooltip-right:before{top:3px}.tooltip-left:after,.tooltip-right:after{margin-left:0;margin-bottom:-10px} 9 | --------------------------------------------------------------------------------