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.5.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.5-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_dynamic_smtp-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 1f31a583696e54967182d7ece23df2275817532a171338a137c2e3b051b1c127
MD5 62164624c1f8ebe5e7f7ee234db71f61
BLAKE2b-256 85331c59ef362e3a2953b85c6ef1e40d6db83a05fabba691c3215ca773e9884f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_dynamic_smtp-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6579da1c6eb01be16b7844b949ac3433556d7da485c22c039f2410041c2bbc06
MD5 c451a377beb19c7f5a17f6e76b70abd7
BLAKE2b-256 36d08397d3902000c42bdfb6fe1b2f21982292d9338c831c3e9c4266cdd3b862

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