Add text/plain part to confirmation and notifiocation mails.
This commit is contained in:
parent
a15b6a0edb
commit
63b0a9edf1
1 changed files with 41 additions and 21 deletions
|
|
@ -333,12 +333,16 @@ sub sendSubscriptionConfirmation {
|
||||||
my $mail = WebGUI::Mail::Send->create( $self->session, {
|
my $mail = WebGUI::Mail::Send->create( $self->session, {
|
||||||
to => $user->get('email'),
|
to => $user->get('email'),
|
||||||
subject => $self->get('confirmationEmailSubject'),
|
subject => $self->get('confirmationEmailSubject'),
|
||||||
|
contentType => 'multipart/alternative',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
my $templateId = $self->get('confirmationEmailTemplateId');
|
my $templateId = $self->get('confirmationEmailTemplateId');
|
||||||
my $template = WebGUI::Asset::Template->new( $session, $templateId );
|
my $template = WebGUI::Asset::Template->new( $session, $templateId );
|
||||||
if ( $template ) {
|
if ( $template ) {
|
||||||
$mail->addHtml( $template->process( $var ) );
|
my $content = $template->process( $var );
|
||||||
|
|
||||||
|
$mail->addHtml( $content );
|
||||||
|
$mail->addText( $self->transformToText( $content ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$session->log->error( "Cannot instanciate confirmation email template with id [$templateId]" );
|
$session->log->error( "Cannot instanciate confirmation email template with id [$templateId]" );
|
||||||
|
|
@ -364,12 +368,16 @@ sub sendNoMutationEmail {
|
||||||
my $mail = WebGUI::Mail::Send->create( $self->session, {
|
my $mail = WebGUI::Mail::Send->create( $self->session, {
|
||||||
to => $user->get('email'),
|
to => $user->get('email'),
|
||||||
subject => $self->get('noMutationEmailSubject'),
|
subject => $self->get('noMutationEmailSubject'),
|
||||||
|
contentType => 'multipart/alternative',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
my $templateId = $self->get('noMutationEmailTemplateId');
|
my $templateId = $self->get('noMutationEmailTemplateId');
|
||||||
my $template = WebGUI::Asset::Template->new( $session, $templateId );
|
my $template = WebGUI::Asset::Template->new( $session, $templateId );
|
||||||
if ( $template ) {
|
if ( $template ) {
|
||||||
$mail->addHtml( $template->process( $var ) );
|
my $content = $template->process( $var );
|
||||||
|
|
||||||
|
$mail->addHtml( $content );
|
||||||
|
$mail->addText( $self->transformToText( $content ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$session->log->error( "Cannot instanciate no mutation email template with id [$templateId]" );
|
$session->log->error( "Cannot instanciate no mutation email template with id [$templateId]" );
|
||||||
|
|
@ -383,6 +391,18 @@ sub sendNoMutationEmail {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub transformToText {
|
||||||
|
my $self = shift;
|
||||||
|
my $html = shift;
|
||||||
|
|
||||||
|
my $text = $html;
|
||||||
|
#HTML::Entities::decode($text);
|
||||||
|
$text =~ s/<a.*?href=["'](.*?)['"].*?>(.+?)<\/a>/$2 ($1)/g;
|
||||||
|
$text = WebGUI::HTML::html2text($text);
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
sub logConfirmation {
|
sub logConfirmation {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue