my %var = ('FirstName'=>'John Doe',
                     'time' => '12:12:56',
                     'date' => '2002-12-12');


  $line =~ s{<([^>]+)>} { exists( $var{$1} ) ? $var{$1} : "" }gsex;

"Colin Johnstone" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Gidday all,
>
> I wish to slurp in a letter template in the form of a text file and
> substitute fields in the letter for variables that are input on my html
> form. I indicate in the text file where the substitution should take place
> by the use of a <tag> like in html.
>
> the Text file looks like this
>
> <snip>
> Dear <FirstName>,
>
> Your registration for our workshops has been successfully processed.
>
> Date: <date>
>
> Venue: <SelectCity>
>
> Time: <time>
>
> You have nominated to attend the following two workshops:
>
> <Workshop1>
>
> <workshop2>
>
> We look forward to seeing you.
>
> </snip>
>
> This is then to be sent as an email to the person who registered. I've
done
> the code it is below.
>
> <code>
>
> #!/usr/local/bin/perl
>
> print "Content-Type: text/html\n\n";
>
> $autoResponse = "responsepage.txt";
> $from = "colin\@johnstonefamily.com";
> $to = "colinjohnstone\@ozemail.com.au";
> $subject = "Testing.. Testing..";
> $sendmailpath="/usr/sbin/sendmail";
>
> #$inFile = "c:/xitami/cgi-bin/hp_data/".$autoResponse;
> $inFile =
> "/home/bdweb8083m/johnstonefamily.com/cgi-bin/hp_data/".$autoResponse;
>
> open (SENDMAIL, "| $sendmailpath -t");
> print SENDMAIL "Subject: $subject\n";
> print SENDMAIL "From: $from\n";
> print SENDMAIL "To: $to\n\n";
> print SENDMAIL "This is a test e-mail.\n\n";
>
> $/ = "undef";
> open(IN, "<$inFile") or die("Cannot open: $!");
> while( $email_body = <IN>){
>     print SENDMAIL "$email_body\n\n";
>   }
> close(IN);
>
> print SENDMAIL "Bye!\n\n";
> close (SENDMAIL);
>
> print("sending to...: $to<br>");
>
> </code>
>
> All I need is help substituting the tags for the variables.
>
> Any help appreciated.
>
> Thank You
>
> Colin
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to