From 14a1a03ba6e998cc4284e6b5917272c259d9f2e1 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Wed, 13 Oct 2010 18:03:39 +0200 Subject: [PATCH] Adding Unsubscribe command. --- lib/WebGUI/MailCommand/Unsubscribe.pm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lib/WebGUI/MailCommand/Unsubscribe.pm diff --git a/lib/WebGUI/MailCommand/Unsubscribe.pm b/lib/WebGUI/MailCommand/Unsubscribe.pm new file mode 100644 index 0000000..e7ca1ca --- /dev/null +++ b/lib/WebGUI/MailCommand/Unsubscribe.pm @@ -0,0 +1,27 @@ +package WebGUI::MailCommand::Unsubscribe; + +use strict; +use warnings; + +use WebGUI::AssetAspect::Subscriber; + +use base 'WebGUI::MailCommand'; + +#----------------------------------------------------------------------------- +sub process { + my $self = shift; + my $listName = shift; + my $fromAddress = shift; + my $session = $self->session; + + my $asset = WebGUI::AssetAspect::Subscriber->getAssetByListName( $session, $listName ); + + die "Invalid list name [$listName]" unless $asset; + + $asset->unsubscribeAnonymous( $fromAddress ); + + return; +} + +1; +