Skip to main content

Configure email settings in the admin

Project description

Django dynamic SMTP

Configure email configuration in the admin.

Usage

  1. Install with pip install django-dynamic-smtp

  2. Add dynamic_smtp and some dependencies to INSTALLED_APPS:

INSTALLED_APPS = [
    ...,
    "django_object_actions",
    "tinymce",
    "dynamic_smtp",
]
  1. Configure your email backend:
EMAIL_BACKEND = (
    "django.core.mail.backends.console.EmailBackend"
    if DEBUG
    else "dynamic_smtp.email.DynamicSMPTEmailBackend"
)
  1. Migrate: ./manage.py migrate
  2. Configure tinymce. Example:
TINYMCE_JS_URL = "https://cdnjs.cloudflare.com/ajax/libs/tinymce/7.0.1/tinymce.min.js"
TINYMCE_DEFAULT_CONFIG = {
    "theme": "silver",
    "height": 600,
    "width": 700,
    "resize": "both",
    "plugins": "advlist,autolink,lists,link,image,charmap,print,preview,anchor,"
    "searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,paste,"
    "help,wordcount",
    "license_key": "gpl",
}

See django-tinymce's documentation for more options.

  1. Access you admin and configure your SMTP settings

Customize model admin

  1. Don't let our app register the default model admin:
# settings.py

...
DYNAMIC_SMPT_REGISTER_ADMIN = False
DYNAMIC_SMPT_REGISTER_MODEL = False
  1. Register your custom admin
# myapp/models.py

from dynamic_smtp.models import AbstractEmailConfiguration

class EmailConfiguration(AbstractEmailConfiguration):
    pass
# myapp/admin.py

from django.contrib import admin
from dynamic_smtp.models import AbstractEmailConfiguration

from .models import Emailconfiguration


@admin.register(EmailConfiguration)
class CustomModelAdmin(EmailConfigurationAdmin):
    class Media:
        css = {"all": ["myapp/style.css"]}

Dependencies

This package needs quite a few dependencies, considering its simplicity.

  • Django
  • beautifulsoup4 and lxml: prepare text version of HTML emails
  • django-object-actions: Button for email test
  • django-tinymce: Button for email test
  • django-solo: Use singleton model

Contributing

All contributions are welcome! To setup you environment:

  1. pip install -r dev.requirements.txt
  2. pre-commit install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_dynamic_smtp-0.0.4.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_dynamic_smtp-0.0.4-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file django_dynamic_smtp-0.0.4.tar.gz.

File metadata

  • Download URL: django_dynamic_smtp-0.0.4.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for django_dynamic_smtp-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c1f26decc8972c9aea0ea6feb71f50ebc79e2248d9f8512697e6c3b1e6639ffc
MD5 84a2cdf463e9616741cdd303f32b6a90
BLAKE2b-256 0b86f1b3c6ce6a040d3a994d320673d8e1a255d31e5fd406ab3d0e163fff40bd

See more details on using hashes here.

File details

Details for the file django_dynamic_smtp-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_dynamic_smtp-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 857ad9de33bd7044ce36d52be1759e8f8690facc6b674ebbb0ec8712288842e5
MD5 150d439e5b3fdf78a3b382221b8718b2
BLAKE2b-256 b1cc144f6360d36c4bef7b5931b7fd5bce55ab4082a2d8e5dc6eb4f11aaaa326

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page