Add text/plain part to email.
This commit is contained in:
parent
913b4710e9
commit
0721d6e2da
1 changed files with 15 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
use HTML::TreeBuilder;
|
||||
use WebGUI::HTML;
|
||||
|
||||
use base 'WebGUI::Crud';
|
||||
|
||||
|
|
@ -143,6 +144,18 @@ sub absolutifyURIs {
|
|||
return $tb->as_HTML;
|
||||
}
|
||||
|
||||
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 send {
|
||||
my $self = shift;
|
||||
|
|
@ -160,6 +173,7 @@ sub send {
|
|||
my $asset = $mailing->getAsset;
|
||||
my $content = $asset->processContentAsUser( $mailing->get('issueId'), $self->get('userId'), $configuration );
|
||||
my $body = $self->absolutifyURIs( $content, $asset->getUrl );
|
||||
my $text = $self->transformToText( $body );
|
||||
|
||||
# Mail is a test mail but there is noone to send the result to
|
||||
if ( $self->get( 'isTest' ) && !$self->get('recipientEmail') ) {
|
||||
|
|
@ -201,6 +215,7 @@ sub send {
|
|||
returnPath => "$messageId-bounce\@$domain",
|
||||
} );
|
||||
$mail->addHtml( $body );
|
||||
$mail->addText( $text );
|
||||
|
||||
if ( $asset->can( 'getListHeaders' ) ) {
|
||||
my $listHeaders = $asset->getListHeaders( $self->user->get('email') );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue