[rt-users] Forwarding an e-mail with an HTML alternative

Martin Drasar drasar at ics.muni.cz
Fri Feb 7 06:40:29 EST 2014


On 6.2.2014 17:21, Kevin Falcone wrote:
> On Thu, Feb 06, 2014 at 01:07:26PM +0100, Martin Drasar wrote:
> 4.2 does a much better job passing along multipart mails.
> You cannot easily force RT to send a custom alternative email,
> especially not in 4.0.

Thanks for your response. I am not necessarily looking for an easy way
to make RT do my bidding and upgrade is not an option right now. In a
way, I do not really need to use the template at all, incoming messages
are formated just as I want them to be.

I wanted to create a scrip that would just forward the mail to
requestors (that are set on ticket create via the REST interface). But I
have some problems with it.

This is my scrip:

*********
package RT::Action::ForwardGatewayReport;

use strict;
use warnings;

use base qw(RT::Action::SendEmail);

use Email::Address;

sub Prepare {
    my $self = shift;
    # Set recipients to ticket requestors
    $self->SetRecipients();
    return 1;
}

sub Commit {
  my $self = shift;

  my $mail;

  # ???
  # What here?
  # ???

  my $rc = $self->SendMessage($mail);
  if ($rc && RT->Config->Get('RecordOutgoingEmail'))
  {
    $self->RecordOutgoingMailTransaction($mail);
  }
  return $rc;
}
**********

I have tried to recreate the $mail with transaction attachments read as
ContentAsMIME() but I have never managed to successfully extract the
original email.

The other thing I have in mind is to create a new mime object of type
multipart/alternative and insert those two text/plain and text/html
parts. But that seems to me a bit cumbersome, given that everything is
already there.

Other issue I am having is that using this script, the correspondence
gets recorded gazzilion times and not just once. Do you have any idea,
where the problem might be?

Thanks,
Martin



More information about the rt-users mailing list