Jump to content
Santiago Botto

Domain ID variable for email templates

Recommended Posts

Hi! I know that someone previously asked this here but I'm not able to submit replies there.

The only answer that question got was to try {$domain_id}, but that variable does not exist (at least, not in the scope of a domain's email template).

Does anyone know how to get the ID of a domain from within an email template? The value is at column id from table tbldomains.

Thanks!

Share this post


Link to post
Share on other sites

Use EmailPreSend to load domain IDs from tbldomains with a query then declare {$domain_id} custom variable so that it's equal to your array.

Share this post


Link to post
Share on other sites
On 19/10/2019 at 19:17, Santiago Botto said:

The only answer that question got was to try {$domain_id}, but that variable does not exist (at least, not in the scope of a domain's email template).

have you checked that by testing it? just because it isn't listed in the merge field list at the bottom of the template, doesn't mean that it doesn't exist - that's not a complete list!

3JPdPVe.png

the above is from the "Expired Domain Notice" email template and $domain_id clearly exists and contains the correct ID value for that domain.

On 19/10/2019 at 19:17, Santiago Botto said:

Does anyone know how to get the ID of a domain from within an email template? The value is at column id from table tbldomains.

note I would expect $domain_id to only exist in Domain Type email templates... if you're searching for the domain ID value in another email template type, then you may have to query the db based on the variables that you do have access to in that template.

Share this post


Link to post
Share on other sites
7 hours ago, Kian said:

Use EmailPreSend to load domain IDs from tbldomains with a query then declare {$domain_id} custom variable so that it's equal to your array.

Yes, I think that's my only choice... Thanks!

 

 

2 hours ago, brian! said:

have you checked that by testing it? just because it isn't listed in the merge field list at the bottom of the template, doesn't mean that it doesn't exist - that's not a complete list!

3JPdPVe.png

the above is from the "Expired Domain Notice" email template and $domain_id clearly exists and contains the correct ID value for that domain.

note I would expect $domain_id to only exist in Domain Type email templates... if you're searching for the domain ID value in another email template type, then you may have to query the db based on the variables that you do have access to in that template.

Yes, I tested the existence of variable $domain_id by sending a Domain Type email with some text and hat variable properly formatted, that's why I clarified that it does "not exist (at least, not in the scope of a domain's email template)" since I'm able to get it from other areas, as you show from the output of Smarty's debug window.

 

If anyone has a way of getting $domain_id on the scope of a domain's email template without the need for EmailPreSend, it would be greatly appreciated! 

Share this post


Link to post
Share on other sites
17 hours ago, Santiago Botto said:

If anyone has a way of getting $domain_id on the scope of a domain's email template without the need for EmailPreSend, it would be greatly appreciated! 

i'm confused - the above debug window shows that, in these domain templates, you can access the variable via Smarty in the email template itself... 😕

so I guess that we've reached the stage where we need to ask - what you want to do with this domain ID value?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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