From 358663f1e408118c7704eb46532309bdb31b0fee Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 23 Jul 2025 12:28:34 +0700 Subject: [PATCH] ezmail initial commit --- templates/ezmail/LICENSE | 21 ++ templates/ezmail/README.md | 39 +++ templates/ezmail/html/template.html | 372 ++++++++++++++++++++++++++++ templates/ezmail/main.py | 13 + 4 files changed, 445 insertions(+) create mode 100644 templates/ezmail/LICENSE create mode 100644 templates/ezmail/README.md create mode 100644 templates/ezmail/html/template.html create mode 100644 templates/ezmail/main.py diff --git a/templates/ezmail/LICENSE b/templates/ezmail/LICENSE new file mode 100644 index 0000000..2434508 --- /dev/null +++ b/templates/ezmail/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Dita Aji Pratama + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/templates/ezmail/README.md b/templates/ezmail/README.md new file mode 100644 index 0000000..30928a5 --- /dev/null +++ b/templates/ezmail/README.md @@ -0,0 +1,39 @@ +# CostaPy Template - EzMail +A simple CostaPy email template. +Email template create by [Colorlib](https://github.com/ColorlibHQ/email-templates/tree/master/10). + +## Usage + +- Put the folder in your templates directory +- Add to handler + + import templates.ezmail.main as ezmail + + kwargs["mako"] = { + "email" : ezmail.main(directory.page["email"], "verification") # page_directory, file_name + } + +- Define a necessary variable on your modules function + + title = "CostaPy" + heading = title + image = "https://sample.com/logo.png" + unsubscribe = "https://sample.com/unsubscribe" + + message = "Please verify your email" + link = "https://sample.com/verify" + +- Set a template on your modules function + + from mako.template import Template + + interface = Template(params["mako"]["email"]['template']).render( + title = title, + heading = heading, + image = image, + unsubscribe = unsubscribe, + container = Template(params["mako"]["email"]['container']).render( + message = message, + link = link + ) + ) diff --git a/templates/ezmail/html/template.html b/templates/ezmail/html/template.html new file mode 100644 index 0000000..ce965ec --- /dev/null +++ b/templates/ezmail/html/template.html @@ -0,0 +1,372 @@ + + + + + + + + ${title} + + + + + + + + + + + + + + + +
+
+ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌  +
+ +
+ + diff --git a/templates/ezmail/main.py b/templates/ezmail/main.py new file mode 100644 index 0000000..66878e2 --- /dev/null +++ b/templates/ezmail/main.py @@ -0,0 +1,13 @@ +from core import html + +static = [] + +def main(dir, page): + + html_template = html.main.get_html("templates/ezmail/html") + html_page = html.main.get_html(dir) + params_list = { + "template" : html_template ["template.html" ] , + "container" : html_page [ page+".html" ] + } + return params_list