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.3.tar.gz (6.0 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.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_dynamic_smtp-0.0.3.tar.gz
  • Upload date:
  • Size: 6.0 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.3.tar.gz
Algorithm Hash digest
SHA256 fc75adac6bb92cfe65091f7a99894ae3489c022210f1de806a9bbecf342094d6
MD5 907d2cefe3d570da5722deb67420ff59
BLAKE2b-256 1452c0f86f008cf1c3ed28d7d396bb0f287a84ae4f987f2ecab180f1e87a297f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_dynamic_smtp-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fa97ecf95bd9cc84b4394c98303b0ed7264b7ccba73494e754417308ebccb621
MD5 b3513573d0037e7cef2bb5fe03744c76
BLAKE2b-256 d460a76b0f96779cf24a83c5c7f29d807345307888f93358e799f2fcd03ea4ca

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