in reply to Replacing a [TAG] in a Email Template

Your Question is pretty similar to this thread, I think you will find both answers to that thread pretty relevant to your question.

-enlil

  • Comment on Re: Replacing a [TAG] in a Email Template

Replies are listed 'Best First'.
Re: Re: Replacing a [TAG] in a Email Template
by zby (Vicar) on Apr 18, 2003 at 19:18 UTC
    Yeah - the problem seems to be identical. I would like just to add that Template Toolkit has a database plugin.
Re: Re: Replacing a [TAG] in a Email Template
by lisaw (Beadle) on Apr 18, 2003 at 22:30 UTC
    I figured it out. I just had to reset the template to its original layout by re-opening the template after sending each email.
    print MAIL $sendthis, "\n"; close (MAIL); open (FILE, "$datadir/sendme.txt") || &error_message("Can't file temp +file for sending mail - $datadir/sendme.txt."); $sendthis = <FILE>; close(FILE); } }
    Have a Happy Easter!

      Instead of re-reading your template file each time (remember - disk I/O is expensive), read the template once and then manipulate a copy for each email you send. Take a look at the following (very rough code)...

      $sendthis = <FILE>; foreach my $mailrecord (@list_of_addresses_and_names_etc) { my $msg = $sendthis; # manipulate the $msg and send }