Hi Richard,

You are replacing the placeholders in $mail_template, but you are storing
the results in $mail_content.

> $mail_content = str_replace('##fullname##',$fullname,$mail_template);
> $mail_content = str_replace('##email##',$email,$mail_template);

This means that each time you call the str_replace function, you are
overwriting what was generated by the previous call to str_replace.

Just change $mail_content to $mail_template and everything should work.

--zak

----- Original Message -----
From: "Richard Kurth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 20, 2001 2:32 AM
Subject: [PHP] email templates and str_replace


>   I am trying to set up a template for an email program below you will
>   see the test program the $mail_template is pulled from a database
>   that is pre saved when it is saved the Placeholders are filled in
>   using str_replace. that is what I want it to do. But it does not work.
What am
>   I missing hear.
>
> $mail_template= "<html>
> <head>
>         <title>Web Hosting At ##hostdomain## </title>
> </head>
>
> <body bgcolor='#C4C9DB'>
> <font size='4' color='#008080'><strong>Dear ##fullname## </strong></font>
> <br><br>
> <font size='4' color='#008080'><strong>Your webhosting account has been
created. Please use the following data to log in to ##domain##
</strong></font>
> <br>
> <font size='4' color='#008080'>
> <strong><ul type=square>
>         <li>Domain:##domain##   </li>
>         <li>IP-Address: ##ip## </li>
>         <li>Username: ##username##</li>
>         <li>Password: ##password##</li>
>         <li>Mysql Database: ##userdatabase##  </li>
>         <li>Mysql Username: ##newuser## </li>
>         <li>Mysql Password: ##newuserpass## </li>
> </ul>  </strong>
> </font>
>
> <font size='4' color='#008080'><strong>Thanks for choosing ##hostdomain##
<br> Any Questions e-mail ##sales##@##hostdomain##</strong> </font>
>
> </body>
> </html>
> ";
>
> /* message*/
> //$mail_template = $message;
>
> $fullname="Richard Kurth";
>  $email="[EMAIL PROTECTED]";
>  $hostdomain="northwesthost.com";
>  $hostname="www";
>  $domain="twohot";
>   $tld=".com";
>  $baseip="234.444.45.444";
>  $username="rkurth";
>  $password="boat";
>  $userdatabase="twohot";
>  $newuser="twohot";
>  $newuserpass="twohot";
>  $sales="sales";
> $domainname=$hostname . "." . $domain . $tld;
>
>
> $mail_content = str_replace('##fullname##',$fullname,$mail_template);
> $mail_content = str_replace('##email##',$email,$mail_template);
> $mail_content = str_replace('##domain##',$domainname,$mail_template);
> $mail_content = str_replace('##ip##',$baseip,$mail_template);
> $mail_content = str_replace('##username##',$username,$mail_template);
> $mail_content = str_replace('##password##',$password,$mail_template);
> $mail_content =
str_replace('##userdatabase##',$userdatabase,$mail_template);
> $mail_content = str_replace('##newuser##',$newuser,$mail_template);
> $mail_content =
str_replace('##newuserpass##',$newuserpass,$mail_template);
> $mail_content = str_replace('##hostdomain##',$hostdomain,$mail_template);
> $mail_content = str_replace('##sales##',$sales,$mail_template);
> /* and now mail it */
> /* recipients */
> $recipient = "$fullname <$email>" ;
> //header
> $headers .="From: Sales Department < [EMAIL PROTECTED] \n>";
> $headers .= "reply-To:$from\nX-Mailer: PHP/" .phpversion()." \n";
> $headers .= "Content-Type: text/html; charset=iso-8859-1\n";
> //subject
> $subject1 = $subject;
> //mail($recipient, $subject1, $mail_content, $headers);
> //print "$recipient, $subject1, $mail_content, $headers";
> echo $mail_content;
>
>
>
>
>
>
>
>
>
>
>
> Best regards,
>  Richard
> mailto:[EMAIL PROTECTED]
>

Reply via email to