Adding basic list header support.
This commit is contained in:
parent
218ebbbad6
commit
573813f5ee
2 changed files with 27 additions and 0 deletions
|
|
@ -105,6 +105,25 @@ sub getEditTabs {
|
||||||
return ( $self->next::method, [ 'subscription', 'Subscription', 9 ] );
|
return ( $self->next::method, [ 'subscription', 'Subscription', 9 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
sub getListHeaders {
|
||||||
|
my $self = shift;
|
||||||
|
my $email = shift || return {};
|
||||||
|
|
||||||
|
my $site = $self->session->url->getSiteURL;
|
||||||
|
|
||||||
|
my $headers = {
|
||||||
|
'List-Unsubscribe' =>
|
||||||
|
'<' . $site . $self->getUrl( "func=processSubscription&action=unsubscribe&email=$email" ) . '>',
|
||||||
|
'List-Subscribe' =>
|
||||||
|
'<' . $site . $self->getUrl( "func=processSubscription&action=subscribe&email=$email" ) . '>',
|
||||||
|
'List-Archives' =>
|
||||||
|
'<' . $site . $self->getUrl . '>',
|
||||||
|
};
|
||||||
|
|
||||||
|
return $headers;
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
sub canSubscribe {
|
sub canSubscribe {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,14 @@ sub send {
|
||||||
} );
|
} );
|
||||||
$mail->addHtml( $body );
|
$mail->addHtml( $body );
|
||||||
|
|
||||||
|
if ( $asset->can( 'getListHeaders' ) ) {
|
||||||
|
my $listHeaders = $asset->getListHeaders( $self->user->get('email') );
|
||||||
|
|
||||||
|
while ( my ($header, $value) = each %{ $listHeaders } ) {
|
||||||
|
$mail->addHeaderField( $header, $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# And send it.
|
# And send it.
|
||||||
my $success = $mail->send;
|
my $success = $mail->send;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue