Re: variables in a e-mail

From: Date: Mon, 18 Jun 2001 23:01:45 +0000
Subject: Re: variables in a e-mail
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54287@lists.php.net to get a copy of this message
Hiho, Richard Kurth wrote: > How can I add a variable to an e-mail on the fly. Say I have a form on > my page that the user fells in with data. but when he fills in the > message things like Hello,$Variable are added before it is sent. Does > this make sence Of course it does. However, variables are not the way to go. The mails are not parsed, so variables won't do you any good. You'll have to use Placeholders. Something like this: $mail_template = "Hi ##firstname## ##lastname##, how are you..."; Now you can continue with str_replace(): $mail_content = str_replace('##firstname##',$fname,$mail_template); $mail_content = str_replace('##lastname##',$lname,$mail_content); regards Wagner -- "Isn't it strange? The same people who laugh at gypsy fortune tellers take economists seriously." - Cincinnati Enquirer

« previous php.general (#54287) next »