Giter Club home page Giter Club logo

smtpd-test's Introduction

smtpd-test

Giới thiệu:

smtp-test là hệ thống bao gồm 1 SMTP Server và Web UI phục vụ cho việc test gửi email.

Cài đặt:

Yêu cầu:

0. Ubuntu 20.04 (python3)
1. Python: 3.8
2. MongoDB: 4.x

Cài đặt MongoDB với docker-compose:

File docker-compose.yml

version: "3"
services:
  mongodb-4.4:
    image: mongo:4.4
    container_name: mongo-4.4
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: <place-your-password-here>
    volumes:
      - ./data:/data/db
    ports:
      - 127.0.0.1:27017:27017

Clone code từ git:

git clone https://github.com/hanoiancs/smtpd-test.git

Setup python venv:

cd smtpd-test
# Cài đặt gói python3-venv (nếu chưa có):
sudo apt install python3-venv
# Tạo mội trường python cho project:
python3 -m venv venv
# Active môi trường python:
source ./venv/bin/activate

Cài đặt smtpd-test:

# Cài các gói cần thiết (Gặp lỗi `error: invalid command 'bdist_wheel'` bỏ qua không sao hết xD)
python -m pip install -r ./requirements.txt

Cấu hình:

Tạo file .env với nội dung như sau:

FLASK_APP=flaskr
FLASK_ENV=development

SMTP_SERVER_HOSTNAME=127.0.0.1
SMTP_SERVER_PORT=8025
SMTP_SERVER_AUTH_REQUIRED=true
SMTP_SERVER_AUTH_REQUIRE_TLS=false

DB_MONGO_HOST=127.0.0.1
DB_MONGO_PORT=27017
DB_MONGO_USER=root
DB_MONGO_PASSWORD=<your-mongodb-password-here>
DB_MONGO_DATABASE=smtp_server
DB_MONGO_AUTHENTICATION_DATABASE=admin

Chạy SMTP server:

python smtpd.py

Chạy Web UI:

Mở 1 tab terminal mới, thực hiện lại bước Setup python venv. WebUI sẽ mặc định chạy ở địa chỉ http://127.0.0.1:5000

flask run

Tạo SMTP auth:

Command dưới đây sẽ tạo 1 cặp username/password để kết nối tới smtp server với username là hello và password ngẫu nhiên (được in ra sau khi script chạy xong):

flask auth create hello 

Giả sử output là:

Inserted new client: 60865de8b5a0170b75928f26
User: hello
Password: wDmCv7h8DIpJh3EL

Setup Laravel .env file:

MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=8025
MAIL_USERNAME=hello
MAIL_PASSWORD=wDmCv7h8DIpJh3EL
MAIL_ENCRYPTION=null
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

smtpd-test's People

Watchers

Quan Tran Anh 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.