forked from TDTP/admin_transporte_backend
fix
parent
fb7429ed4d
commit
c36dc582ae
|
@ -20,8 +20,6 @@ DB_MONGO_PASS=password
|
|||
SMTP_HOST=smtp-mail.outlook.com
|
||||
SMTP_PORT=587
|
||||
SMTP_PROTOCOL=tls
|
||||
SMTP_USER=francisco.sandoval@outlook.cl
|
||||
SMTP_PASS=aigdvnrbueitklry
|
||||
SMTP_FROM='"Sistema Transporte" <francisco.sandoval@outlook.cl>'
|
||||
|
||||
# PATH UPLOAD
|
||||
|
|
|
@ -14,8 +14,6 @@ DB_REDIS_PORT=6379
|
|||
SMTP_HOST=smtp-mail.outlook.com
|
||||
SMTP_PORT=587
|
||||
SMTP_PROTOCOL=tls
|
||||
SMTP_USER=francisco.sandoval@outlook.cl
|
||||
SMTP_PASS=aigdvnrbueitklry
|
||||
SMTP_FROM='"Sistema Transporte" <francisco.sandoval@outlook.cl>'
|
||||
|
||||
# PATH UPLOAD
|
||||
|
|
|
@ -158,25 +158,21 @@ def nueva_contrasena(request):
|
|||
return HttpResponse('error al cambiar contraseña', status = 500)
|
||||
|
||||
|
||||
|
||||
|
||||
def enviar_correo(destinatario, asunto, contenido):
|
||||
try:
|
||||
template = get_template('correo_recuperar.html') # Ruta al template del correo
|
||||
contenido_renderizado = template.render(contenido)
|
||||
|
||||
mensaje = EmailMultiAlternatives(asunto, '', settings.EMAIL_HOST_USER, [destinatario])
|
||||
mensaje = EmailMultiAlternatives(asunto, contenido, settings.EMAIL_SENDER, [destinatario])
|
||||
mensaje.attach_alternative(contenido_renderizado, 'text/html')
|
||||
mensaje.send()
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f'EMAIL_HOST: {EMAIL_HOST}', flush=True)
|
||||
print(f'EMAIL_HOST: {settings.EMAIL_HOST}', flush=True)
|
||||
print(f'ERROR: {e}', flush=True)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
def http_referer(request):
|
||||
if 'HTTP_REFERER' in request.META:
|
||||
referer = request.META['HTTP_REFERER']
|
||||
|
|
|
@ -182,6 +182,9 @@ LOGGING = {
|
|||
|
||||
EMAIL_HOST = config('SMTP_HOST')
|
||||
EMAIL_PORT = config('SMTP_PORT', 587)
|
||||
EMAIL_HOST_USER = config('SMTP_USER', 'tu_correo@gmail.com') # Tu dirección de correo
|
||||
EMAIL_HOST_PASSWORD = config('SMTP_PASS', 'tu_contraseña') # Tu contraseña de correo
|
||||
EMAIL_USE_TLS = config('SMTP_PROTOCOL') == 'tls'
|
||||
EMAIL_SENDER = config('SMTP_FROM')
|
||||
|
||||
|
||||
#EMAIL_HOST_USER = config('SMTP_USER', 'tu_correo@gmail.com') # Tu dirección de correo
|
||||
#EMAIL_HOST_PASSWORD = config('SMTP_PASS', 'tu_contraseña') # Tu contraseña de correo
|
||||
EMAIL_USE_TLS = config('SMTP_PROTOCOL') == 'plain'
|
||||
|
|
Loading…
Reference in New Issue