punch_card_don has asked for the wisdom of the Perl Monks concerning the following question:
So I'm using Template Toolkit to output dynamic web pages. So far so good.
I'm adding a "email me my profile info" button. When clicked on, I want to retrieve the user's profile info from teh db, populate an email template, send it to the user via sendmail, then populate a confirmation template and serve it to the user saying "ths info was just emailed to you...".
So I tried ( in pseudo code):
Where &send_mail_html contacins, among other things, the usual:$vars = { image_path => $image_path, data => \%data, }; $subject = "contact info"; $template_file = 'contact_info_email.htm'; $template_1->process($template_file, $vars) || die "Template process failed: ", $template->error(), "\n"; &send_mail_html($email, $from_address, $subject, $template_1); $template_file = 'confirm_contact_info_email.htm'; $template->process($template_file, $vars) || die "Template process failed: ", $template->error(), "\n";
And it almost works. The user gets an email, and a confirmation page. But with two problems:$to_address = $_[0]; $from = $_[1]; $subject = $_[2]; $content = $_[3]; ..... print MAIL "To: print MAIL "From: $from\n"; print MAIL "Subject: $subject\n"; print MAIL "$content\n";
So, I'm clearly doing somethign wrong. How should I be doing this?
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Template Toolkit: Output one template to Sendmail, another to browser?
by EvanCarroll (Chaplain) on Aug 26, 2007 at 06:50 UTC | |
by punch_card_don (Curate) on Aug 26, 2007 at 13:47 UTC | |
by clscott (Friar) on Aug 26, 2007 at 17:33 UTC | |
by punch_card_don (Curate) on Aug 27, 2007 at 01:03 UTC | |
by Cap'n Steve (Friar) on Aug 27, 2007 at 01:45 UTC | |
|
Re: Template Toolkit: Output one template to Sendmail, another to browser?
by ides (Deacon) on Aug 26, 2007 at 14:58 UTC |