Code Monkey home page Code Monkey logo

zeptomail_python_api's Introduction

ZeptoMail Python API

Tác giả

Nguyễn Hồng Thế Blog

Mô tả

Kịch bản này gửi email bằng cách sử dụng API của ZeptoMail. Nó cho phép bạn tùy chỉnh nội dung email bằng cách sử dụng các mẫu Jinja2.

Yêu cầu

  1. Python 3.6+
  2. Gói requests (Cài đặt bằng pip install requests).
  3. Gói dotenv (Cài đặt bằng pip install python-dotenv).
  4. Gói Jinja2 (Cài đặt bằng pip install Jinja2).

hoặc cài đặt nhanh thông qua requirements.txt:

pip install -r requirements.txt

Thiết lập

  1. Clone repo này. Hoặc tải xuống và giải nén nếu bạn không sử dụng Git.

  2. Tạo tệp .env trong cùng thư mục với script này với nội dung sau:

    API_URL=<ZeptoMail API URL>
    SENDMAIL_TOKEN=<Your ZeptoMail API token>
    FROM_NAME=<Your Name>
    FROM_EMAIL=<Your Email>
    EMAIL_SUBJECT=<Email Subject>
    TO_EMAIL=<Recipient's Email>
    TO_NAME=<Recipient's Name>
    REPLY_TO_NAME=<Reply-to Name>
    REPLY_TO_EMAIL=<Reply-to Email>
    EMAIL_TEMPLATE=<Path to your email template file>
    
  3. Vui lòng thay các giá trị trống bằng các giá trị thích hợp.

Sử dụng

Chạy script bằng lệnh sau:

python sendmail.py

Tùy chỉnh mẫu template

  1. Tạo tệp mẫu HTML (ví dụ: email_template.html) và xác định bố cục email của bạn bằng HTML và các trình giữ chỗ Jinja2.
  2. Trong script, mẫu được tải và các biến Jinja2 được sử dụng để hiển thị nội dung email.

Đóng góp và báo lỗi

Repo này được đồng bộ tự động với repo.vnscdn.com. Nếu bạn muốn đóng góp hoặc báo lỗi, hãy truy cập vào repo chính nguyenhongthe/repo.vnscdn.com nơi mã gốc được phát triển.

Bản quyền và giấy phép

Copyright (c) 2013-2023 Nguyễn Hồng Thế Blog - Phát hành theo giấy phép MIT.

zeptomail_python_api's People

Contributors

nguyenhongthe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.