from django.core.mail.backends.smtp import EmailBackend
config = Configuration.objects.get(**lookup_kwargs)
backend = EmailBackend(host=config.host, port=congig.port, username=config.
    username, password=config.password, use_tls=config.use_tls,
    fail_silently=config.fail_silently)
Dynamic Django Mail Configuration