Templates — Aquilia Documentation
Comprehensive guide and documentation for Templates in the Aquilia framework. View API reference, examples, and implementation patterns.
Mail / Templates Aquilia Template Syntax (ATS) AquilaMail templates utilize the Aquilia Template Syntax (ATS). ATS provides a simple expression engine designed to prevent code-injection vulnerabilities inside email bodies. ATS Syntax Reference & Complete Example The following example compiles user profiles, loops through purchases, formats localized currency, and structures blocks inside a single transaction receipt template: [[% extends "layouts/base.aqt" %]] [[% block body %]] Hi, >! Thank you for shopping at >. Your order # > has cleared. Your Ordered Items: [[% for item in order.items %]] > (Qty: >) - > [[% endfor %]] [[% if order.discount_amount > 0 %]] Promo applied: - > [[% else %]] No promotional codes applied. [[% endif %]] [[% endblock %]] ATS Syntax Rules , , , , ].map((item, i) => ( ))} Using TemplateMessage Instantiate a TemplateMessage class with the template file path and context payload. Subject lines can also contain inline ATS expressions: from aquilia.mail import TemplateMessage msg = TemplateMessage( template="order_receipt.aqt", context= }, "total": 129.99, "discount_amount": 15.00, "items": [ ] }, "brand_name": "Aquilia Inc" }, subject="Your Receipt for > from >!", to=["asha@example.com"] ) # Template renders at envelope compile time. HTML and text alternative are generated. await msg.asend() Providers Developer Guide )
Go to Homepage