projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT 4.0.19
[freeside.git]
/
rt
/
lib
/
RT
/
Action
/
SendEmail.pm
diff --git
a/rt/lib/RT/Action/SendEmail.pm
b/rt/lib/RT/Action/SendEmail.pm
index
2a7a2e3
..
0f11cc1
100755
(executable)
--- a/
rt/lib/RT/Action/SendEmail.pm
+++ b/
rt/lib/RT/Action/SendEmail.pm
@@
-2,7
+2,7
@@
#
# COPYRIGHT:
#
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-201
2
Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-201
4
Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@
-382,7
+382,7
@@
sub AddAttachments {
=head2 AddAttachment $attachment
=head2 AddAttachment $attachment
-Takes one attachment object of L<RT::Attachm
m
ent> class and attaches it to the message
+Takes one attachment object of L<RT::Attachment> class and attaches it to the message
we're building.
=cut
we're building.
=cut
@@
-397,14
+397,15
@@
sub AddAttachment {
and $attach->TransactionObj->CurrentUserCanSee;
# ->attach expects just the disposition type; extract it if we have the header
and $attach->TransactionObj->CurrentUserCanSee;
# ->attach expects just the disposition type; extract it if we have the header
+ # or default to "attachment"
my $disp = ($attach->GetHeader('Content-Disposition') || '')
my $disp = ($attach->GetHeader('Content-Disposition') || '')
- =~ /^\s*(inline|attachment)/i ? $1 :
undef
;
+ =~ /^\s*(inline|attachment)/i ? $1 :
"attachment"
;
$MIMEObj->attach(
Type => $attach->ContentType,
Charset => $attach->OriginalEncoding,
Data => $attach->OriginalContent,
$MIMEObj->attach(
Type => $attach->ContentType,
Charset => $attach->OriginalEncoding,
Data => $attach->OriginalContent,
- Disposition => $disp,
# a false value defaults to inline in MIME::Entity
+ Disposition => $disp,
Filename => $self->MIMEEncodeString( $attach->Filename ),
'RT-Attachment:' => $self->TicketObj->Id . "/"
. $self->TransactionObj->Id . "/"
Filename => $self->MIMEEncodeString( $attach->Filename ),
'RT-Attachment:' => $self->TicketObj->Id . "/"
. $self->TransactionObj->Id . "/"
@@
-871,21
+872,25
@@
sub SetFrom {
my $self = shift;
my %args = @_;
my $self = shift;
my %args = @_;
+ my $from = $args{From};
+
if ( RT->Config->Get('UseFriendlyFromLine') ) {
my $friendly_name = $self->GetFriendlyName(%args);
if ( RT->Config->Get('UseFriendlyFromLine') ) {
my $friendly_name = $self->GetFriendlyName(%args);
- $self->SetHeader(
- 'From',
+ $from =
sprintf(
RT->Config->Get('FriendlyFromLineFormat'),
$self->MIMEEncodeString(
$friendly_name, RT->Config->Get('EmailOutputEncoding')
),
$args{From}
sprintf(
RT->Config->Get('FriendlyFromLineFormat'),
$self->MIMEEncodeString(
$friendly_name, RT->Config->Get('EmailOutputEncoding')
),
$args{From}
- ),
- );
- } else {
- $self->SetHeader( 'From', $args{From} );
+ );
}
}
+
+ $self->SetHeader( 'From', $from );
+
+ #also set Sender:, otherwise MTAs add a nonsensical value like rt@machine,
+ #and then Outlook prepends "rt@machine on behalf of" to the From: header
+ $self->SetHeader( 'Sender', $from );
}
=head2 GetFriendlyName
}
=head2 GetFriendlyName
@@
-971,7
+976,7
@@
sub SetSubject {
$subject =~ s/(\r\n|\n|\s)/ /g;
$subject =~ s/(\r\n|\n|\s)/ /g;
- $self->SetHeader( 'Subject',
$subject
);
+ $self->SetHeader( 'Subject',
Encode::encode_utf8( $subject )
);
}
}
@@
-985,11
+990,14
@@
sub SetSubjectToken {
my $self = shift;
my $head = $self->TemplateObj->MIMEObj->head;
my $self = shift;
my $head = $self->TemplateObj->MIMEObj->head;
- $head->replace(
- Subject => RT::Interface::Email::AddSubjectTag(
- Encode::decode_utf8( $head->get('Subject') ),
- $self->TicketObj,
- ),
+ $self->SetHeader(
+ Subject =>
+ Encode::encode_utf8(
+ RT::Interface::Email::AddSubjectTag(
+ Encode::decode_utf8( $head->get('Subject') ),
+ $self->TicketObj,
+ ),
+ ),
);
}
);
}