[rt-users] Sending E-Mail From Within Custom Scrips

Thomas Oddsund thomas.oddsund at usit.uio.no
Fri Dec 16 03:31:32 EST 2016


Hello Tim,

As no one has responded, I'll chime in with my non-canonical(?) way that only requires MIME::Entity.

Create a script that fires on whatever condition you wish. In the preparation code, build a MIME::Entity object, and then $mime_object->send. That sends a mail from RT, but doesn't create any transaction. So an easy solution would be something like this in the prep-area:

my $body = MIME::Entity->build(Type => "multipart/mixed",
>From => $fromAddress,
Subject => $subject,
To   => $toAddress,
Data => ["Hello\n",
                  "Close the ticket.\n"
                  "Best regards,\n"
                  "IT Crowd."]);

$body->send;

Docs are found here; http://search.cpan.org/~dskoll/MIME-tools-5.508/lib/MIME/Entity.pm

Best regards,
Thomas Oddsund
RT/SDS/USIT

________________________________________
Fra: rt-users <rt-users-bounces at lists.bestpractical.com> på vegne av Tim Gustafson <tjg at ucsc.edu>
Sendt: 14. desember 2016 23:17
Til: rt-users at lists.bestpractical.com
Emne: [rt-users] Sending E-Mail From Within Custom Scrips

Our university has an "official" ticketing system, and one of our
support groups wants to use RT instead.

To make this happen, we're configuring the "official" ticketing system
to send e-mail to an RT queue.  We've written a custom "on create"
scrip in that queue that modifies the ticket when it comes in to set
the "Requester" correctly (e-mail from the other system comes from a
fixed address, not from the client's address; we parse the contents of
the e-mail to ascertain the client's e-mail address directly).  We'd
like our custom scrip to also send an e-mail to the other system to
close that ticket.

What's the canonical way to send e-mail from RT to an external address
without adding correspondence to the RT ticket itself?  I found some
documentation about how to add a transaction to the ticket from within
the scrip, which generates an e-mail, but that's not really what I
want to do here.  I'd rather send a basic plain-text e-mail from
within the scrip.

Is that possible?

--

Tim Gustafson
tjg at ucsc.edu
831-459-5354
Baskin Engineering, Room 313A
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Los Angeles - January 9-11 2017



More information about the rt-users mailing list