[rt-devel] support for dynamic envelope sender addresses

Shawn M Moore shawn at bestpractical.com
Thu Jul 28 16:03:59 EDT 2016


> On Jul 28, 2016, at 12:50, Sam Hanes <sam at maltera.com> wrote:
> 
> Hi All,

Hey Sam,

> Is it likely that a patch to add a callback capable of setting the
> envelope sender in `RT::Interface::Email::SendEmail()` would be accepted
> upstream?

Yeah, we'd happily take such a patch. As you discovered, callbacks are Mason-specific, so can't be used for this. The way we make library code customizable is by factoring out a small, well-defined method, which a local overlay can then redefine.

A useful technique for this is to take a reference to the original sub reference before redefining it, and then calling it within the redefinition (which works a lot like a subclass dispatching to the superclass's method). For an example of prior art, see https://github.com/bestpractical/rt-extension-onetimeto/blob/a0da9368643/lib/RT/Extension/OneTimeTo.pm#L83-L97

> Should such a callback be passed a reference to the array of `sendmail`
> arguments so it can modify them as desired or should it be expected to
> return an envelope sender address?

A method that returns the list of sendmail arguments might be the best fit.

> Thanks for your consideration,
> Sam Hanes

Thanks,
Shawn

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20160728/1df84036/attachment.pgp>


More information about the rt-devel mailing list