Jump to content

Email template script


kepler

Recommended Posts

Good afternoon

 

I just wanted to place a doubt - maybe someone can help me.

 

In a email template of WHMCS, I want to send a text IF the domain is actually a subdomain of the main. I could use an {if}...{/if} with the product variable {$service_product_name}

 

But is there a way of using a regex for the var {$service_domain} to see if it's a subdomain of example.com for instance?

I don't know very well this scripting language...

 

Also, I would like to place a question: I have for the emails the default language (english) and a 2nd option. Even if I place in the general settings that 2nd language, the emails are sent in english. Is there an extra configuration I'm missing...?

 

 

Kind regards

 

Kepler

Link to comment
Share on other sites

I just wanted to place a doubt - maybe someone can help me.

In a email template of WHMCS, I want to send a text IF the domain is actually a subdomain of the main. I could use an {if}...{/if} with the product variable {$service_product_name}

But is there a way of using a regex for the var {$service_domain} to see if it's a subdomain of example.com for instance?

I don't know very well this scripting language...

I would have thought you could just do this...

 

{if $service_domain|strstr:'.example.com'} do something {/if}

 

Also, I would like to place a question: I have for the emails the default language (english) and a 2nd option. Even if I place in the general settings that 2nd language, the emails are sent in english. Is there an extra configuration I'm missing...?

https://docs.whmcs.com/Email_Templates#Translating_Email_Templates

 

has the client chosen this second language or is their profile set to default/english ?

Link to comment
Share on other sites

I would have thought you could just do this...

{if $service_domain|strstr:'.example.com'} do something {/if}

 

Hi,

 

Thanks for the reply. I think it's a beginning, but there can be the problem of $service_domain be http://www.example.com

 

How can I exclude the www possible match? Could I write something like:

 

{if $service_domain|strstr:'.example.com'}|!strstr:'www.example.com'}

 

Does the ! acts in this type of conditional? I dont know how to put the or (|) and the and (&?) or the not (!) in this script...

 

It's not exactly php per se...

 

Kind regards,

 

Kepler

Link to comment
Share on other sites

  • WHMCS Developer

{if $service_domain|strstr:'.example.com'}|!strstr:'www.example.com'}  

 

Would actually be:

 

{if $service_domain|strstr:'.example.com'}&& $service_domain != "www.example.com"} 

 

And I would actually go a little further:

 

{if $service_domain != "www.example.com" && $service_domain|strstr:'.example.com'}

 

------

 

Email Templates:

 

Changing the default language in Setup -> General Settings changes the default language of your email templates. That means that the "English" version you had is now "Italian" or "Spanish" or whatever you chose as your new default language.

 

If you wish to keep the English version, you would need to add this as a language on your email templates and then re-edit the default templates to be your new default language.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated