Personalised e-mails with if clauses

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BLob

    #1

    Personalised e-mails with if clauses

    Hello,

    I am building a system to deal with inscriptions to events. There is a
    backoffice which allows administrators to send emails to all or to a sub-set
    of the participants. The administrators can enter the text of the emails,
    using a template-like syntax to add fields from the database. For example :
    "Dear {title} {first_name} {last_name}" will produce "Dear John Doe". But I
    would need to add a degree in the way emails can be personalised, with if
    .... elseif ... elseif ... else ... clauses.

    For example :
    {if (transport = 'train')}
    We noted that you will come by train + instructions to come from the
    train station.
    {elseif (transport = 'plane')}
    We noted that you will fligh to Paris + instructions to come....
    {elseif (transport = 'car')}
    Blablabla....
    {endif}

    I could use PHP syntax for the content of the mail and just eval( ) it or do
    something like that, but I don't want to allow anything else than if ...
    elseif ... else ... clauses. I could also use a template system (Smarty) but
    for many reasons I don't use any of those anymore.

    Can you give me an idea about how to do this ?


    Thanks,

    BLob


Working...