Reputation: 37
I was configured email SMTP configurations in settings.py file as below
Now its working fine but my problem is after deploying the project how can I change any parameter like from_mail/password by user input form...Simply I need to update/change email or password.
Upvotes: 0
Views: 889
Reputation: 11477
First, the Django documentation specifically says you shouldn't alter settings at runtime.
https://docs.djangoproject.com/en/2.2/topics/settings/#altering-settings-at-runtime
Fortunately, the send_mail()
method allows the default EMAIL_*
settings to overridden by using the auth_user
and auth_password
arguments.
send_mail(
'Subject here',
'Here is the message.',
'[email protected]',
['[email protected]'],
fail_silently=False,
auth_user='new_user',
auth_password='new_password',
)
Documentation: https://docs.djangoproject.com/en/2.2/topics/email/#send-mail
Upvotes: 0
Reputation: 49
You can always change the parameter at the function call of the django email function:
send_mail(
'Subject here',
'Here is the message.',
'[email protected]',
['[email protected]'],
fail_silently=False,
)
How to set the auth_user/auth_password is explained here: Django Docs Sending email
Upvotes: 0