This topic is locked
[SOLVED]

 standard Email

11/22/2011 5:52:13 AM
PHPRunner General questions
author

I have standard emails that automatically add customized text to the email by adding for example ".$name." in the after event code $name could be the session user name for this example. This works well, however I have a client who would like to write their own standard emails / make alterations using a rich text editor. Can they write the email in the rich text and add [name] in the html and my event would then add the name at that point .i.e replace [name] with ".$name."
How could do this? Is it possible?

C
cgphp 11/22/2011

Check this PHP function: http://www.php.net/manual/en/function.str-replace.php

You can define some patterns like:
[name]

[surname]

[city]

[zip]
When the rich text is saved, in the "Before record added" event replace all the patterns with the related PHP variables:



$values['richtext_field_name_value'] = str_replace("[name]",$name, $values['richtext_field_name_value']);

$values['richtext_field_name_value'] = str_replace("[surname]",$surname, $values['richtext_field_name_value']);

$values['richtext_field_name_value'] = str_replace("[city]",$city, $values['richtext_field_name_value']);

$values['richtext_field_name_value'] = str_replace("[zip]",$zip, $values['richtext_field_name_value']);
7542 11/24/2011

Sorry, that was so obvious. But well explained. Thanks Cristian