This commit was generated by cvs2svn to compensate for changes in r2523,
[freeside.git] / rt / lib / RT / Action / Autoreply.pm
1 #$Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Autoreply.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
2
3 package RT::Action::Autoreply;
4 require RT::Action::SendEmail;
5 @ISA = qw(RT::Action::SendEmail);
6
7
8 # {{{ sub SetRecipients
9
10 =head2 SetRecipients
11
12 Sets the recipients of this message to this ticket's Requestor.
13
14 =cut
15
16
17 sub SetRecipients {
18     my $self=shift;
19
20     push(@{$self->{'To'}}, @{$self->TicketObj->Requestors->Emails});
21     
22     return(1);
23 }
24
25 # }}}
26
27
28 # {{{ sub SetReturnAddress 
29
30 =head2 SetReturnAddress
31
32 Set this message\'s return address to the apropriate queue address
33
34 =cut
35
36 sub SetReturnAddress {
37     my $self = shift;
38     my %args = ( is_comment => 0,
39                  @_
40                );
41     
42     if ($args{'is_comment'}) { 
43         $replyto = $self->TicketObj->QueueObj->CommentAddress || 
44                      $RT::CommentAddress;
45     }
46     else {
47         $replyto = $self->TicketObj->QueueObj->CorrespondAddress ||
48                      $RT::CorrespondAddress;
49     }
50     
51     unless ($self->TemplateObj->MIMEObj->head->get('From')) {
52         my $friendly_name=$self->TicketObj->QueueObj->Name;
53         $self->SetHeader('From', "\"$friendly_name\" <$replyto>");
54     }
55     
56     unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
57         $self->SetHeader('Reply-To', "$replyto");
58     }
59     
60 }
61   
62 # }}}
63
64 1;