my product settings start
This commit is contained in:
@@ -22,6 +22,46 @@ class BaseService:
|
||||
SEND_EMAIL_PASS = Config.SEND_EMAIL_PASS
|
||||
THIS_SITE_URL = Config.THIS_SITE_URL
|
||||
|
||||
@staticmethod
|
||||
def send_completepass_mail(signup_email, pending_uid, pending_id, firstname, lastname):
|
||||
msg_body = f"""
|
||||
Hello {firstname},
|
||||
|
||||
Password Reset Completed
|
||||
|
||||
|
||||
For any Support
|
||||
Reach Out
|
||||
support@mermsemr.com
|
||||
"""
|
||||
|
||||
sender_email = BaseService.SEND_EMAIL_FROM
|
||||
sender_password = BaseService.SEND_EMAIL_PASS
|
||||
receiver_email = signup_email
|
||||
subject = "Reset Password Completed"
|
||||
body = msg_body
|
||||
|
||||
msg = MIMEMultipart()
|
||||
msg['Subject'] = subject
|
||||
msg['From'] = sender_email
|
||||
msg['To'] = receiver_email
|
||||
msg.attach(MIMEText(body, 'plain')) # or 'html' for HTML content
|
||||
|
||||
try:
|
||||
# For Gmail, use 'smtp.gmail.com' and port 587 (TLS) or 465 (SSL)
|
||||
# For other providers, consult their documentation for SMTP server and port
|
||||
server = smtplib.SMTP('smtp.gmail.com', 587)
|
||||
# server.starttls() # Enable TLS encryption
|
||||
server.login(sender_email, sender_password)
|
||||
server.sendmail(sender_email, receiver_email, msg.as_string())
|
||||
print("Email sent successfully!")
|
||||
except Exception as e:
|
||||
print(f"Error sending email: {e}")
|
||||
logger.error(f"Error sending email: {e}")
|
||||
finally:
|
||||
server.quit() # Close the connection
|
||||
|
||||
|
||||
@staticmethod
|
||||
def send_resetpass_mail(signup_email, pending_uid, pending_id, firstname, lastname):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user