auto email changs

This commit is contained in:
Ubuntu 2024-05-11 05:27:20 +00:00
parent ad3829e8ae
commit d9cc5ece67
2 changed files with 19 additions and 3 deletions

View File

@ -642,8 +642,20 @@ ISO_LAN = {v: k for k, v in languages.items()}
# ] # ]
#EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
#EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# SMTP server settings
EMAIL_HOST = 'smtp.gmail.com' # Replace 'smtp.example.com' with your SMTP server address
EMAIL_PORT = 587 # Replace with your SMTP server port, typically 587 for TLS/STARTTLS
EMAIL_USE_TLS = True # Enable TLS/STARTTLS if required
# SMTP authentication settings
#EMAIL_HOST_USER = 'your_email@example.com' # Replace with your email address
EMAIL_HOST_PASSWORD = 'iiby yciy jdux fslv' # Replace with your email password
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER') EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
smtp_host = os.environ.get('SMTP_HOST') smtp_host = os.environ.get('SMTP_HOST')
smtp_port = int(os.environ.get('SMTP_PORT')) smtp_port = int(os.environ.get('SMTP_PORT'))
@ -653,6 +665,8 @@ smtp_password = os.environ.get('SMTP_PASSWORD')
COUNTRY_KEY = "00000000000000000000000000000000" COUNTRY_KEY = "00000000000000000000000000000000"
def discount_xlsx_reader(filePath:str): def discount_xlsx_reader(filePath:str):
import pandas as pd import pandas as pd
discountData = dict() discountData = dict()

View File

@ -160,9 +160,11 @@ def mailer(all_email,email_code,key_value,filePath):
port = int(email_data.iloc[0, 2]) port = int(email_data.iloc[0, 2])
password = emails_creadentials.objects.get(email=from_email) password = emails_creadentials.objects.get(email=from_email)
print("before connection") print("before connection")
connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True) #connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True)
from_email1 = "mynextfilm <noreply@mynextfilm>"
# send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection) # send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection)
sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,to=[to_email],connection=connection) sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email1,[to_email])
print("after connection") print("after connection")
sendMail.attach_alternative(msg_html,"text/html") sendMail.attach_alternative(msg_html,"text/html")
if filePath is not None: if filePath is not None: