[rt-devel] Re: SetEnvelopeTo

Tobias Brox tobiasb at tobiasb.funcom.com
Thu Apr 6 14:55:43 EDT 2000


> Perhaps, SetRecipients should take
> 
> %args = ( To => undef,
> 	  Cc => undef,
> 	  Bcc =>undef,
> 	  EnvelopeTo => undef);
> 
> and do the right thing with setting envelope-to to the sum of To,Cc and Bcc.

I think that is a bit out of the scope of "my" SetRecipients.  The idea is
to allow the _logic_ to be easily separated.  That is, _finding_ the right
To, Cc, Bcc and EnvelopeTo.  Maybe I'm wrong.

Here's from the file I'm working at:

POD:

If you want to set the recipients of the mail to something other than
the addresses mentioned in the To, Cc, Bcc and EnvelopeTo headers in
the template, you should subclass RT::Action::SendEmail and override
either the SetRecipients method or the SetTo, SetCc, etc methods (see
the comments for the SetRecipients sub).

Comments & sub:

# The specialized SetRecipients sub should find out whom to send the
# message to, and then set the header fields.

# If SendEmail is called rather than a subclass, the receipients have
# to be set by the template.

# There is three ways to override this (well, more ways ... you could
# of course add the logic to a specialized prepare or commit or
# something ... but that's not considered a good way to do it anyway).

# 1: Override SetRecipients to set the header fields (to, cc, bcc) and
#    eventually call SetEnvelopeTo
# 2: Override SetRecipients to set the hash elements $self->{To}, {Cc}
#    and {Bcc}, and then call SUPER::SetRecipients.
# 3: Override SetTo, SetCc and/or SetBcc.

sub SetRecipients {
  $self->SetTo();
  $self->SetCc();
  $self->SetBcc();
  $self->SetEnvelopeTo();
}






More information about the Rt-devel mailing list