Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Way to pass in a template set into send_email() ?

Quote Reply
Way to pass in a template set into send_email() ?
Hi,

I'm trying to work out the best way to send an email from a script in SSH. I wanna be able to pass a template set (based on the language preferance of the user its being sent to). From a web-based script, you would just need to pass in t=xxx ... but I'm having to do a bit of a dirty hack to Links.pm send_email() to try and get this to work:

Code:
$parsed = user_page($template, $vars, { compress => 0 });

..to:

Code:
if ($_[2]->{template}) {
$parsed = user_page($template, $vars, { compress => 0, template => $_[2]->{template} });
} else {
$parsed = user_page($template, $vars, { compress => 0 });
}

Then user_page():

Code:
$vars = $vars->get_hash if UNIVERSAL::isa($vars, 'GT::CGI');
$IN->param('t' => $opts->{template} ); # added

Then in my script:

Code:
Links::send_email('validate.eml', $user, { template => 'fr' } ) or die "Unable to send message: $GT::Mail::error";

Not ideal :) Is there a better way to pass this along to send_email() ? My solution works, but if there is a built-in way, I would prefer to use that (so I don't break the updates)

TIA

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Way to pass in a template set into send_email() ? Andy 2960 Feb 6, 2013, 9:47 AM
Thread Re: [Andy] Way to pass in a template set into send_email() ?
Andy 2894 Feb 6, 2013, 10:08 AM
Post Re: [Andy] Way to pass in a template set into send_email() ?
Andy 2842 Feb 7, 2013, 2:33 AM