$NL = $NEWSLETTER->getNL($nl_id);
 if (count($NL) > 0) {
     $memo .= " (" . $NL[0]['subject'] . ")";
 }
 //set status adresse, set editor...
 $author = "unsubscribe";
 //always unsubscribe ...
 if ($ADDRESS->unsubscribe($ADR[0]['id'], $author)) {
     $ADDRESS->setAktiv($ADR[0]['id'], 0);
     $ADDRESS->addMemo($ADR[0]['id'], $memo);
     //unsubscribed
     if ($C[0]['unsubscribe_action'] == "blacklist" || $C[0]['unsubscribe_action'] == "blacklist_delete") {
         //add adr to blacklist
         if (!$BLACKLIST->isBlacklisted($ADR[0]['email'], "email", 0)) {
             //only_active=0, also alle, nicht nur aktive, was default waere
             $BLACKLIST->addBL(array("siteid" => TM_SITEID, "expr" => $ADR[0]['email'], "aktiv" => 1, "type" => "email"));
         }
     }
     if ($C[0]['unsubscribe_action'] == "delete" || $C[0]['unsubscribe_action'] == "blacklist_delete") {
         $ADDRESS->delAdr($ADR[0]['id']);
     }
     if ($C[0]['notify_unsubscribe'] == 1) {
         //email bei subscrption an admin....
         $SubscriptionMail_Subject = "Tellmatic: Abmeldung / Unsubscribe";
         $SubscriptionMail_HTML = "";
         $SubscriptionMail_HTML .= "<br><b>" . $created . "</b>\n" . "<br>'<b>" . $memo . "</b>'\n" . "<br>AID: <b>" . $ADR[0]['id'] . "</b>\n" . "<br>\n" . "<br>Folgender Benutzer hat sich aus der Verteilerliste ausgetragen und moechte kein Newsletter mehr erhalten:\n" . "<br>The following user has unsubscribed:\n" . "<ul>Daten:\n" . "<li>e-Mail: <b>" . $ADR[0]['email'] . "</b></li>\n" . "<li>F0: <b>" . $ADR[0]['f0'] . "</b></li>\n" . "<li>F1: <b>" . $ADR[0]['f1'] . "</b></li>\n" . "<li>F2: <b>" . $ADR[0]['f2'] . "</b></li>\n" . "<li>F3: <b>" . $ADR[0]['f3'] . "</b></li>\n" . "<li>F4: <b>" . $ADR[0]['f4'] . "</b></li>\n" . "<li>F5: <b>" . $ADR[0]['f5'] . "</b></li>\n" . "<li>F6: <b>" . $ADR[0]['f6'] . "</b></li>\n" . "<li>F7: <b>" . $ADR[0]['f7'] . "</b></li>\n" . "<li>F8: <b>" . $ADR[0]['f8'] . "</b></li>\n" . "<li>F9: <b>" . $ADR[0]['f9'] . "</b></li>\n" . "</ul>\n" . "<br>\n" . "Code: <b>" . $code . "</b>\n" . "<br>\n" . "<br>\n" . "Der Datensatz wurde de-aktiviert und markiert (Unsubscribed) und wurde ab sofort aus der Empfaengerliste ausgeschlossen.\n" . "<br>The Address has been deactivated and marked as unsubscribed and will be excluded from recipients list.\n";
         @SendMail_smtp($HOST[0]['sender_email'], $HOST[0]['sender_name'], $C[0]['notify_mail'], $HOST[0]['sender_name'], $SubscriptionMail_Subject, clear_text($SubscriptionMail_HTML), $SubscriptionMail_HTML, array(), $HOST);
         //fixed, now uses defaulthost
         //now use smtp directly
         //sendmail_smtp[0]=true/false [1]=""/errormessage
         if ($C[0]['unsubscribe_sendmail'] == 1) {
 }
 //check single
 if ($user_is_manager && $set == "delete_history" && $doit == 1) {
     if (!DEMO) {
         $QUEUE->clearH(array("adr_id" => $adr_id));
     }
     $_MAIN_MESSAGE .= "<br>" . ___("Historie wurde gelöscht.");
 }
 //del history single
 if ($user_is_manager && $set == "blacklist") {
     $ADR_BL = $ADDRESS->getAdr($adr_id);
     //dublettencheck
     //	function isBlacklisted($str,$type="all")
     if (!$BLACKLIST->isBlacklisted($ADR_BL[0]['email'], "email", 0)) {
         //only_active=0, also alle, nicht nur aktive, was default waere
         $BLACKLIST->addBL(array("siteid" => TM_SITEID, "expr" => $ADR_BL[0]['email'], "aktiv" => 1, "type" => "email"));
         $_MAIN_MESSAGE .= "<br>" . sprintf(___("Die E-Mail-Adresse %s wurde in die Blacklist eingetragen."), display($ADR_BL[0]['email']));
     } else {
         $_MAIN_MESSAGE .= "<br>" . sprintf(___("Die E-Mail-Adresse %s ist bereits in der Blacklist vorhanden."), display($ADR_BL[0]['email']));
     }
 }
 //blacklist single
 if ($user_is_manager && $set == "blacklist_domain") {
     $ADR_BL = $ADDRESS->getAdr($adr_id);
     $bl_domainname = getDomainFromEMail($ADR_BL[0]['email']);
     //dublettencheck
     //	function isBlacklisted($str,$type="all")
     if (!$BLACKLIST->isBlacklisted($ADR_BL[0]['email'], "domain", 0)) {
         //only_active=0, also alle, nicht nur aktive, was default waere
         //wenn noch nicht vorhanden einfuegen:
         $BLACKLIST->addBL(array("siteid" => TM_SITEID, "expr" => $bl_domainname, "aktiv" => 1, "type" => "domain"));
 if ($type == "email") {
     $check_mail = checkEmailAdr($expr, $EMailcheck_Intern);
     if (!$check_mail[0]) {
         $check = false;
         $_MAIN_MESSAGE .= "<br>" . sprintf(___("E-Mail %s hat ein falsches Format."), display($expr)) . " " . $check_mail[1];
     }
 }
 if ($check) {
     if (!DEMO) {
         $BLACKLIST = new tm_BLACKLIST();
         //dublettencheck, anders als in adr_list, dort ist nur typ domain und email, hier wuerde isBlacklisted bei regexp probleme machen, ganze email erwartet!
         //eintrag suchen:
         $BL = $BLACKLIST->getBL(0, array("type" => $type, "expr" => $expr));
         //wenn nix gefunden, eintragen:
         if (count($BL) < 1) {
             $BLACKLIST->addBL(array("siteid" => TM_SITEID, "expr" => $expr, "aktiv" => $aktiv, "type" => $type));
         } else {
             $_MAIN_MESSAGE .= "<br>" . sprintf(___("Der Eintrag %s ist bereits vorhanden."), "'<b>" . display($expr) . "</b>'");
         }
         //if count
     }
     //demo
     $_MAIN_MESSAGE .= "<br>" . sprintf(___("Neuer Eintrag %s wurde angelegt."), "'<b>" . display($expr) . "</b>'");
     $action = "bl_list";
     include_once TM_INCLUDEPATH . "/bl_list.inc.php";
 } else {
     //check
     require_once TM_INCLUDEPATH . "/bl_form.inc.php";
     require_once TM_INCLUDEPATH . "/bl_form_show.inc.php";
 }
 //check