|
Posted by Juby on 05/16/06 00:58
We're trying to put together a mail merge from a MySQL database we
have. However, when I run preg_replace on the text of the email, so we
can put in specific information about the customer, it doesn't seem to
be working. Here's an example of what we're doing:
$mailbody = "This email was sent to %email% because you have
purchased items or requested information from DARcorporation. If this
e-mail was sent to you in error or you want to be removed from our
mailing list, please reply and type \"Remove\" in the subject line.
Copyright © 1991-2006 DARcorporation. All rights reserved. Privacy
Statement.";
preg_replace("/%email%/",$name,$mailbody);
When that bit of code is run, the string "%email%" remains unchanged in
$mailbody. I'm sure there's something wrong with my regular
expression, but I just can't seem to figure out what it is. If someone
could help me out, not only fixing the regex but telling me what I'm
doing wrong, I would be very appreciative. I've even run this thing
through a regex checking program I have and it works, and I'm about to
start putting heads through walls.
Navigation:
[Reply to this message]
|