Kevin,<br><br>The template would look like this:<br><br>To: {$Ticket->FirstCustomFieldValue('ToOverride')}@<a href="http://lbl.gov">lbl.gov</a><br>Subject: Request Titled: "{$Ticket->Subject}" is ready to Migrate!<br>
<br>A scrip based on whatever condition would do this:<br><br>my $trans = $self->TransactionObj;<br>my $ticket = $self->TicketObj;<br>my $cf_obj = new RT::CustomField($RT::SystemUser);<br>my $cf_name = "ToOverride";<br>
<br>if condition is "A"<br> $my $cf_value = "the To address you want for "A" condition";<br>elsif condition is "B"<br> $my $cf_value = "the To address you want for "B" condition";<br>
<br>and on and on till you're thru.<br><br>then, set the Custom Field as the last piece of action code:<br><br>$cf_obj->LoadByName(Name=>$cf_name);<br>$RT::Logger->debug("Loaded\$cf_obj->Name = ". $cf_obj->Name() ."\n" );<br>
$ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value, RecordTransaction=>0 );<br><br>return 1;<br><br><br>Then write a notification scrip to use the new template based on your conditions.<br>Use "TransactioBatch" for both scrips.<br>
<br>Hope this helps.<br><br>Kenn<br>LBNL<br><br><div class="gmail_quote">On Fri, Dec 10, 2010 at 11:55 AM, Kevin Falcone <span dir="ltr"><<a href="mailto:falcone@bestpractical.com">falcone@bestpractical.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Fri, Dec 10, 2010 at 11:07:32AM -0800, Kurt Engle wrote:<br>
> Actually found a nice example of creating a template to send out an e-mail. RTFM....<br>
><br>
> However, I am having a bit of a problem constructing the To: field. Basically, I have a<br>
> varialble '$toAddress' that is set to an e-mail address by some prior code.<br>
<br>
</div>Where in the code is it set. It would really need to be in that<br>
template<br>
<div class="im"><br>
> Here is my template code to construct the To: field:<br>
> To: { $toAddress }<br>
> Subject: Ticket #{ $Ticket->Id()} {$Ticket->Subject()}<br>
> A new ticket has been created for you in the HelpDesk Queue.<br>
><br>
> { $RT::WebURL } Ticket/Display.html?id={ $Ticket->Id() }<br>
><br>
> However, I keep getting 'recipient not found'.<br>
<br>
</div>In debug logging mode, RT will actually dump copies of the email being<br>
processed into the logs, which would show you the To:<br>
<br>
Please note that if To: is your email address and you're the actor on<br>
this ticket while testing, you may have told RT not to send you email<br>
in that case using $NotifyActor<br>
<div><div></div><div class="h5"><br>
-kevin<br>
<br>
> ----------------------------------------------------------------------------------------------<br>
><br>
> From: "Kevin Falcone" <<a href="mailto:falcone@bestpractical.com">falcone@bestpractical.com</a>><br>
> To: <a href="mailto:rt-users@lists.bestpractical.com">rt-users@lists.bestpractical.com</a><br>
> Sent: Friday, December 10, 2010 10:03:04 AM<br>
> Subject: Re: [rt-users] notification<br>
><br>
> On Fri, Dec 10, 2010 at 09:55:07AM -0800, Kurt Engle wrote:<br>
> > That is correct. But how do I make use of the RT::Action::SendEmail module to send the<br>
> > notification incorporating my To: field. Or is there a better way to send out a custom<br>
> > notification?<br>
><br>
> You use one of the standard Notify actions and a custom template. You<br>
> don't write any code in the action and you don't call the action<br>
> directly.<br>
><br>
> -kevin<br>
><br>
> > From: "Kevin Falcone" <<a href="mailto:falcone@bestpractical.com">falcone@bestpractical.com</a>><br>
> > To: <a href="mailto:rt-users@lists.bestpractical.com">rt-users@lists.bestpractical.com</a><br>
> > Sent: Friday, December 10, 2010 8:59:25 AM<br>
> > Subject: Re: [rt-users] notification<br>
> ><br>
> > On Thu, Dec 09, 2010 at 11:42:03AM -0800, Kurt Engle wrote:<br>
> > > I am looking for a way to send an email from RT to a specified e-mail address that<br>
> is not<br>
> > an<br>
> > > account in RT or associated with the ticket as a requestor, watcher, CC:,<br>
> BCC:...etc....<br>
> > ><br>
> > > I have the logic down to specify the e-mail address and have some nasty perl code to<br>
> > actually<br>
> > > send the e-mail. But, it seems that RT has some internal module(s) that handle what<br>
> the<br>
> > nasty<br>
> > > perl code is doing.<br>
> > ><br>
> > > I can see the RT::Action:SendEmail module, but how do I incorporate that into a<br>
> script<br>
> > that<br>
> > > allows me to do what I am looking to do?<br>
> ><br>
> > Sounds like you actually just want to use a normal Notify action, but<br>
> > have the template contain your ugly logic that sets up the To: line<br>
> > based on your perl code<br>
> ><br>
> > -kevin<br>
</div></div></blockquote></div><br>