1 # $Header: /home/cvs/cvsroot/freeside/rt/lib/RT/Action/Attic/SendPasswordEmail.pm,v 1.1 2002-08-12 06:17:07 ivan Exp $
2 # Copyright 2001 Jesse Vincent <jesse@fsck.com>
3 # Released under the terms of the GNU Public License
5 package RT::Action::SendPasswordEmail;
6 require RT::Action::Generic;
8 @ISA = qw(RT::Action::Generic);
13 RT::Action::SendGenericEmail - An Action which users can use to send mail
14 or can subclassed for more specialized mail sending behavior.
20 require RT::Action::SendPasswordEmail;
25 Basically, you create another module RT::Action::YourAction which ISA
26 RT::Action::SendEmail.
28 If you want to set the recipients of the mail to something other than
29 the addresses mentioned in the To, Cc, Bcc and headers in
30 the template, you should subclass RT::Action::SendEmail and override
31 either the SetRecipients method or the SetTo, SetCc, etc methods (see
32 the comments for the SetRecipients sub).
37 ok (require RT::TestHarness);
38 ok (require RT::Action::SendPasswordEmail);
45 Jesse Vincent <jesse@bestpractical.com>
53 # {{{ Scrip methods (_Init, Commit, Prepare, IsApplicable)
57 #Do what we need to do and send it out.
67 my $MIMEObj = $self->TemplateObj->MIMEObj;
70 $MIMEObj->make_singlepart;
72 #If we don\'t have any recipients to send to, don\'t send a message;
73 unless ($MIMEObj->head->get('To')) {
74 $RT::Logger->debug("$self: No recipients found. Not sending.\n");
78 if ($RT::MailCommand eq 'sendmailpipe') {
79 open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0);
80 print MAIL $MIMEObj->as_string;
84 unless ($MIMEObj->send($RT::MailCommand, $RT::MailParams)) {
85 $RT::Logger->crit("$self: Could not send mail for ".
86 $self->TransactionObj . "\n");
101 # This actually populates the MIME::Entity fields in the Template Object
103 unless ($self->TemplateObj) {
104 $RT::Logger->warning("No template object handed to $self\n");
108 unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {
109 $self->SetHeader('Reply-To',$RT::CorrespondAddress );
113 $self->SetHeader('Precedence', "bulk");
114 $self->SetHeader('X-RT-Loop-Prevention', $RT::rtname);
116 ('Managed-by',"Request Tracker $RT::VERSION (http://www.fsck.com/projects/rt/)");
118 $self->TemplateObj->Parse(Argument => $self->Argument);
133 Sets this message's "To" field to EMAIL
140 $self->SetHeader('To',$to);
154 $self->TemplateObj->MIMEObj->head->fold_length($field,10000);
155 $self->TemplateObj->MIMEObj->head->add($field, $val);
156 return $self->TemplateObj->MIMEObj->head->get($field);