diff --git a/easy_unsubscribe.php b/easy_unsubscribe.php index 644bb8c..b6a4a22 100644 --- a/easy_unsubscribe.php +++ b/easy_unsubscribe.php @@ -29,16 +29,16 @@ class easy_unsubscribe extends rcube_plugin $this->message_headers_done = true; $ListUnsubscribe = $p['headers']->others['list-unsubscribe']; - preg_match('/<(.*?)>/', $ListUnsubscribe, $rVal); + + preg_match('%\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))%i', $ListUnsubscribe, $UnsubURL); + preg_match('/mailto:(.*?)>/', $ListUnsubscribe, $UnsubEmail); + + if(!empty($UnsubURL[0])) + $this->unsubscribe_img = 'Unsubscribe'; + + if(!empty($UnsubEmail[1])) + $this->unsubscribe_img .= 'Unsubscribe'; - if($rVal[1]!='') - $this->unsubscribe_img = 'Unsubscribe'; - else - { - preg_match('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $ListUnsubscribe, $rVal); - if($rVal[0]!='') - $this->unsubscribe_img = 'Unsubscribe'; - } } if(isset($p['output']['subject']))