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 model admin

  1. Don't let our app register the default model admin, and register your new model as the holder of email configurations.
# settings.py

...
DYNAMIC_SMPT_REGISTER_ADMIN = False
DYNAMIC_SMPT_EMAIL_CONFIGURATION_MODEL = "myapp.EmailConfiguration"
  1. Create your custom model
# myapp/models.py

from dynamic_smtp.models import AbstractEmailConfiguration

class EmailConfiguration(AbstractEmailConfiguration):
    pass
  1. Create your custom model admin
# 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: HTML editing for signature
  • 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.6.tar.gz (7.1 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.6-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_dynamic_smtp-0.0.6.tar.gz
  • Upload date:
  • Size: 7.1 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.6.tar.gz
Algorithm Hash digest
SHA256 1b773b3f512f31eff6c5260be9dd9a5d528aa10b661c813e0481fd159ca11cdd
MD5 6e33b4fcfc1acb25cb523b5e8651ea9e
BLAKE2b-256 a9760a09edbeeadc10e1439858935b33659f92c10058d13ef1c7a208921f6c96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_dynamic_smtp-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 45447797e6310920efd69fd2dd63a8df937099ecb41d5789d4184879452d39c5
MD5 8262bf75d91b8e75426c908d6dd43ddc
BLAKE2b-256 9144b4e914dab2a9e880756bd8a35676b4d4a3eb010d42f8081d25c9a8837b09

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