Gregniuki commited on
Commit
fe5eb9d
1 Parent(s): f6cb392

Update emailx.py

Browse files
Files changed (1) hide show
  1. emailx.py +5 -9
emailx.py CHANGED
@@ -11,7 +11,7 @@ MAILJET_API_SECRET = os.environ['MAILJET_API_SECRET']
11
  # Create a Mailjet client
12
  mailjet = Client(auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3.1')
13
 
14
- def send_verification_email(to_email, verification_token):
15
  # Create the email message
16
  email_data = {
17
  'Messages': [
@@ -26,8 +26,8 @@ def send_verification_email(to_email, verification_token):
26
  "Name": "User Name"
27
  }
28
  ],
29
- "Subject": "Verify Your Email",
30
- "HTMLPart": f'Click <a href="https://gregniuki-loginauth.hf.space/verify/{verification_token}">here</a> to verify your email.'
31
  }
32
  ]
33
  }
@@ -36,13 +36,9 @@ def send_verification_email(to_email, verification_token):
36
  try:
37
  response = mailjet.send.create(data=email_data)
38
  if response.status_code == 200:
39
- print(response.status_code)
40
- print(response.json())
41
- print("Verification email sent successfully.")
42
  else:
43
- print("Failed to send verification email.")
44
- print(response.status_code)
45
- print(response.json())
46
  except Exception as e:
47
  print(str(e))
48
 
 
11
  # Create a Mailjet client
12
  mailjet = Client(auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3.1')
13
 
14
+ def send_verification_email(to_email, reset_link):
15
  # Create the email message
16
  email_data = {
17
  'Messages': [
 
26
  "Name": "User Name"
27
  }
28
  ],
29
+ "Subject": "Reset or verifie",
30
+ "HTMLPart": f'Please click <a href="{reset_link}">here</a> to reset password or verifie your email.'
31
  }
32
  ]
33
  }
 
36
  try:
37
  response = mailjet.send.create(data=email_data)
38
  if response.status_code == 200:
39
+ print("Password reset email sent successfully.")
 
 
40
  else:
41
+ print("Failed to send password reset email.")
 
 
42
  except Exception as e:
43
  print(str(e))
44