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:
..to:
$parsed = user_page($template, $vars, { compress => 0, template => $_[2]->{template} });
} else {
$parsed = user_page($template, $vars, { compress => 0 });
}
Then user_page():
$IN->param('t' => $opts->{template} ); # added
Then in my script:
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!
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!