Jump to content

Trying to str_replace an entire mail message.


scrubbicus

Recommended Posts

The body would be something like:

 

$body =

"Thank you for registering with ^^url_name^^, if you could just click the link below to activate your account you can navigate throughout the entire network with just one login!

 

^^activation_link^^

 

Once clicked, you'll be brought to your control panel where you can start editing your online information and more menus will be opened up for you. We hope you find what you were browsing for.

 

Thanks,

^^site_name^^

^^url_link^^

";

 

$replace = array(

"^^site_name^^" => "ScrubbDesigns",

"^^url_name^^" => "<a href=\"http://www.url.com\">Name</a>",

"^^url_link^^" => "<a href=\"http://www.url.com\">www.url.com</a>",

"^^activation_link^^"         => $activation_link,

"^^to_name^^" => $to['name'],

"^^to_email^^" => $to['email'],

"^^from_email^^" => $from['email'],

"^^subject^^" => $from['subject'],

"^^message^^" => $from['message'],

"^^find_us^^" => $from['find'],

"^^from_name^^" => $from['name'],

);

 

foreach($replace as $k => $v) echo "str_replace($k,$v,$body) <P />";

Link to comment
Share on other sites

Well a few things...

 

str_replace allows for an array input of search and an array of replacement values. You might want to look into that instead.

 

And when echo'ing the return value of a function, the function must not be inside of quotes. You have:

echo "str_replace($k,$v,$body) <P />";

It would need to be:

echo str_replace($k,$v,$body)." <P />";
// or
echo str_replace($k,$v,$body)," <P />";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.