
sartak at bestpractical
Nov 6, 2009, 12:49 PM
Post #1 of 1
(53 views)
Permalink
|
|
rt branch, 3.8-trunk, updated. rt-3.8.6-79-gd3e0842
|
|
The branch, 3.8-trunk has been updated via d3e08429723d85804365820f08e00d26173f08bf (commit) via 7c7494de7508343948e750db6210f7fb12bca9d8 (commit) via 177b396f8889db717a972e1fe5c42e4b4573eed9 (commit) via cb9b2716a21a92f288f62548386a4ed2dbcb1e6f (commit) via faa431530cb245fa2b9dfc6f2f31480b2550aaae (commit) from 0181edeef105bb8ca53002375368222c86962521 (commit) Summary of changes: etc/RT_Config.pm.in | 24 ++++++++++++++++++++++ lib/RT/Interface/Email.pm | 48 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 11 deletions(-) - Log ----------------------------------------------------------------- commit faa431530cb245fa2b9dfc6f2f31480b2550aaae Author: Carlos Fuentes Bermejo <carlos.fuentes[at]rediris.es> Date: Fri Nov 6 15:33:11 2009 -0500 If there is no ticket for outgoing mail, check a new configuration option for the From address diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in index 1933c12..1503376 100755 --- a/etc/RT_Config.pm.in +++ b/etc/RT_Config.pm.in @@ -372,6 +372,29 @@ if you use 'sendmail' rather than 'sendmailpipe' Set($MailCommand , 'sendmailpipe'); +=item C<$SetOutgoingMailFrom> + +C<$SetOutgoingMailFrom> enables that RT sets the sender envelope with +the +correspond mail address of the ticket's queue. + +Warning: If you use RT in this way, you should know that bounce mails +will +be incoming to the system, and creating new tickets. +=cut + +Set ($SetOutgoingMailFrom, 1); + +=item C<$OverrideOutgoingMailFrom> + +C<$OverrideOutgoingMailFrom> is used for overwriting the Correspond +address of the queue. + +=cut +Set($OverrideOutgoingMailFrom, { +} +); + =back =head1 Sendmail Configuration diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm index 1279816..0396935 100755 --- a/lib/RT/Interface/Email.pm +++ b/lib/RT/Interface/Email.pm @@ -382,12 +382,35 @@ sub SendEmail { # if it is a sub routine, we just return it; return $mail_command->($args{'Entity'}) if UNIVERSAL::isa( $mail_command, 'CODE' ); + my $ticketObj = $args{'Ticket'}; + my $transactionObj = $args{'Transaction'}; + if ( $mail_command eq 'sendmailpipe' ) { my $path = RT->Config->Get('SendmailPath'); my $args = RT->Config->Get('SendmailArguments'); - $args .= ' '. RT->Config->Get('SendmailBounceArguments') if $args{'Bounce'}; - - # VERP + + # SetOutgoingMailFrom + + my $outgoingMailAddress; + if ( RT->Config->Get('SetOutgoingMailFrom') ) { + if ( defined $ticketObj ){ + my $queueName = $ticketObj->QueueObj->Name; + if (not defined RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}) { + $outgoingMailAddress = $ticketObj->QueueObj->CorrespondAddress; + } else { + $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}; + } + $args .= ' -f '.$outgoingMailAddress; + } elsif (RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'} ) { + $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'}; + $args .= ' -f '.$outgoingMailAddress; + } + } + + # Set Bounce Arguments + $args .= ' '. RT->Config->Get('SendmailBounceArguments') if $args{'Bounce'}; + + # VERP if ( $args{'Transaction'} and my $prefix = RT->Config->Get('VERPPrefix') and my $domain = RT->Config->Get('VERPDomain') ) commit cb9b2716a21a92f288f62548386a4ed2dbcb1e6f Author: Shawn M Moore <sartak[at]bestpractical.com> Date: Fri Nov 6 15:36:15 2009 -0500 Documentation tweaks for new OutgoingMailFrom config diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in index 1503376..3481f94 100755 --- a/etc/RT_Config.pm.in +++ b/etc/RT_Config.pm.in @@ -374,26 +374,27 @@ Set($MailCommand , 'sendmailpipe'); =item C<$SetOutgoingMailFrom> -C<$SetOutgoingMailFrom> enables that RT sets the sender envelope with -the -correspond mail address of the ticket's queue. +C<$SetOutgoingMailFrom> tells RT to set the sender envelope with the correspond +mail address of the ticket's queue. + +Warning: If you use this setting, bounced mails will appear to be incoming +mail to the system, thus creating new tickets. -Warning: If you use RT in this way, you should know that bounce mails -will -be incoming to the system, and creating new tickets. =cut -Set ($SetOutgoingMailFrom, 1); +Set($SetOutgoingMailFrom, 0); =item C<$OverrideOutgoingMailFrom> C<$OverrideOutgoingMailFrom> is used for overwriting the Correspond -address of the queue. +address of the queue. The option is a hash reference of queue name to +email address. =cut + Set($OverrideOutgoingMailFrom, { -} -); +# 'General' => 'general[at]rt.example.com', +}); =back commit 177b396f8889db717a972e1fe5c42e4b4573eed9 Author: Shawn M Moore <sartak[at]bestpractical.com> Date: Fri Nov 6 15:40:12 2009 -0500 Pluck Ticket and Transaction out of %args sooner diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm index 0396935..ba15d3a 100755 --- a/lib/RT/Interface/Email.pm +++ b/lib/RT/Interface/Email.pm @@ -315,6 +315,10 @@ sub SendEmail { Transaction => undef, @_, ); + + my $TicketObj = $args{'Ticket'}; + my $TransactionObj = $args{'Transaction'}; + foreach my $arg( qw(Entity Bounce) ) { next unless defined $args{ lc $arg }; @@ -339,26 +343,26 @@ sub SendEmail { return -1; } - if ( $args{'Transaction'} && !$args{'Ticket'} - && $args{'Transaction'}->ObjectType eq 'RT::Ticket' ) + if ( $TransactionObj && !$TicketObj + && $TransactionObj->ObjectType eq 'RT::Ticket' ) { - $args{'Ticket'} = $args{'Transaction'}->Object; + $TicketObj = $TransactionObj->Object; } if ( RT->Config->Get('GnuPG')->{'Enable'} ) { my %crypt; my $attachment; - $attachment = $args{'Transaction'}->Attachments->First - if $args{'Transaction'}; + $attachment = $TransactionObj->Attachments->First + if $TransactionObj; foreach my $argument ( qw(Sign Encrypt) ) { next if defined $args{ $argument }; if ( $attachment && defined $attachment->GetHeader("X-RT-$argument") ) { $crypt{$argument} = $attachment->GetHeader("X-RT-$argument"); - } elsif ( $args{'Ticket'} ) { - $crypt{$argument} = $args{'Ticket'}->QueueObj->$argument(); + } elsif ( $TicketObj ) { + $crypt{$argument} = $TicketObj->QueueObj->$argument(); } } @@ -382,21 +386,18 @@ sub SendEmail { # if it is a sub routine, we just return it; return $mail_command->($args{'Entity'}) if UNIVERSAL::isa( $mail_command, 'CODE' ); - my $ticketObj = $args{'Ticket'}; - my $transactionObj = $args{'Transaction'}; - if ( $mail_command eq 'sendmailpipe' ) { my $path = RT->Config->Get('SendmailPath'); my $args = RT->Config->Get('SendmailArguments'); - + # SetOutgoingMailFrom - + my $outgoingMailAddress; if ( RT->Config->Get('SetOutgoingMailFrom') ) { - if ( defined $ticketObj ){ - my $queueName = $ticketObj->QueueObj->Name; + if ( defined $TicketObj ){ + my $queueName = $TicketObj->QueueObj->Name; if (not defined RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}) { - $outgoingMailAddress = $ticketObj->QueueObj->CorrespondAddress; + $outgoingMailAddress = $TicketObj->QueueObj->CorrespondAddress; } else { $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}; } @@ -409,13 +410,13 @@ sub SendEmail { # Set Bounce Arguments $args .= ' '. RT->Config->Get('SendmailBounceArguments') if $args{'Bounce'}; - + # VERP - if ( $args{'Transaction'} and + if ( $TransactionObj and my $prefix = RT->Config->Get('VERPPrefix') and my $domain = RT->Config->Get('VERPDomain') ) { - my $from = $args{'Transaction'}->CreatorObj->EmailAddress; + my $from = $TransactionObj->CreatorObj->EmailAddress; $from =~ s/@/=/g; $from =~ s/\s//g; $args .= " -f $prefix$from\@$domain"; commit 7c7494de7508343948e750db6210f7fb12bca9d8 Author: Shawn M Moore <sartak[at]bestpractical.com> Date: Fri Nov 6 15:44:53 2009 -0500 Use spaces for indentation not tabs diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm index ba15d3a..f2a978a 100755 --- a/lib/RT/Interface/Email.pm +++ b/lib/RT/Interface/Email.pm @@ -390,28 +390,28 @@ sub SendEmail { my $path = RT->Config->Get('SendmailPath'); my $args = RT->Config->Get('SendmailArguments'); - # SetOutgoingMailFrom - - my $outgoingMailAddress; - if ( RT->Config->Get('SetOutgoingMailFrom') ) { - if ( defined $TicketObj ){ - my $queueName = $TicketObj->QueueObj->Name; - if (not defined RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}) { - $outgoingMailAddress = $TicketObj->QueueObj->CorrespondAddress; - } else { - $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}; - } - $args .= ' -f '.$outgoingMailAddress; - } elsif (RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'} ) { - $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'}; - $args .= ' -f '.$outgoingMailAddress; - } - } - - # Set Bounce Arguments - $args .= ' '. RT->Config->Get('SendmailBounceArguments') if $args{'Bounce'}; - - # VERP + # SetOutgoingMailFrom + + my $outgoingMailAddress; + if ( RT->Config->Get('SetOutgoingMailFrom') ) { + if ( defined $TicketObj ){ + my $queueName = $TicketObj->QueueObj->Name; + if (not defined RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}) { + $outgoingMailAddress = $TicketObj->QueueObj->CorrespondAddress; + } else { + $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}; + } + $args .= ' -f '.$outgoingMailAddress; + } elsif (RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'} ) { + $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'}; + $args .= ' -f '.$outgoingMailAddress; + } + } + + # Set Bounce Arguments + $args .= ' '. RT->Config->Get('SendmailBounceArguments') if $args{'Bounce'}; + + # VERP if ( $TransactionObj and my $prefix = RT->Config->Get('VERPPrefix') and my $domain = RT->Config->Get('VERPDomain') ) commit d3e08429723d85804365820f08e00d26173f08bf Author: Shawn M Moore <sartak[at]bestpractical.com> Date: Fri Nov 6 15:48:24 2009 -0500 More cleanup diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm index f2a978a..97fe2a8 100755 --- a/lib/RT/Interface/Email.pm +++ b/lib/RT/Interface/Email.pm @@ -392,20 +392,22 @@ sub SendEmail { # SetOutgoingMailFrom - my $outgoingMailAddress; if ( RT->Config->Get('SetOutgoingMailFrom') ) { - if ( defined $TicketObj ){ - my $queueName = $TicketObj->QueueObj->Name; - if (not defined RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}) { - $outgoingMailAddress = $TicketObj->QueueObj->CorrespondAddress; + my $OutgoingMailAddress; + + if ($TicketObj) { + my $QueueName = $TicketObj->QueueObj->Name; + if (not defined RT->Config->Get('OverrideOutgoingMailFrom')->{$QueueName}) { + $OutgoingMailAddress = $TicketObj->QueueObj->CorrespondAddress; } else { - $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{$queueName}; + $OutgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{$QueueName}; } - $args .= ' -f '.$outgoingMailAddress; - } elsif (RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'} ) { - $outgoingMailAddress = RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'}; - $args .= ' -f '.$outgoingMailAddress; } + + $OutgoingMailAddress ||= RT->Config->Get('OverrideOutgoingMailFrom')->{'Default'}; + + $args .= ' -f ' . $OutgoingMailAddress + if $OutgoingMailAddress; } # Set Bounce Arguments ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit[at]lists.bestpractical.com http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|