search

Home  >  Q&A  >  body text

Create email templates that can contain parameters

<p>I want users to be able to create their own templates to send emails and looking for a way to add their own parameters that I can capture and add the actual values ​​from the database. </p> <p>I am using Simiditor to edit text</p> <p>(https://i.stack.imgur.com/w0JE3.png)](https://i.stack.imgur.com/w0JE3.png)</p> <p>No good solution has been found yet</p>
P粉575055974P粉575055974457 days ago533

reply all(1)I'll reply

  • P粉517090748

    P粉5170907482023-09-04 09:53:31

    If I understand correctly, you want to allow the user to edit the text template using the following parameters

    {clientName}
    {selectedVonderName}

    Then add the actual value in the database (such as mysql data)

    In this case, use str_replace to do the job

    For example, if you get data from mysql database data and then assign the data as $clientName and $selectedVonderName, then

    <?php
    /// other code
    
    $text=".......{clientName} ....{selectedVonderName}";
    
    $text=str_replace("{clientName}", $clientName, $text);
    $text=str_replace("{selectedVonderName}", $selectedVonderName, $text);
    
    /// other code
    ?>

    reply
    0
  • Cancelreply