Merge pull request #826 from udit19281/master

Update smtp_web.py
This commit is contained in:
David Kennedy 2021-04-12 15:07:51 -04:00 committed by GitHub
commit 632afa6791
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -384,8 +384,8 @@ def mail(to, subject, prioflag1, prioflag2, text):
# try logging in with base64 encoding here
import base64
try:
mailServer.docmd("AUTH LOGIN", base64.b64encode(provideruser))
mailServer.docmd(base64.b64encode(pwd), "")
mailServer.docmd("AUTH LOGIN", base64.b64encode(provideruser.encode()))
mailServer.docmd(base64.b64encode(pwd.encode()), "")
# except exceptions and print incorrect password
except Exception as e:
@ -403,7 +403,7 @@ if option1 == '1':
# if we specify to track users, this will replace the INSERTUSERHERE with
# the "TO" field.
if track_email.lower() == "on":
body_new = body_new.replace("INSERTUSERHERE", base64.b64encode(to))
body_new = body_new.replace("INSERTUSERHERE", base64.b64encode(to.encode()))
# call the function to send email
try:
mail(to, subject, prioflag1, prioflag2, body_new)
@ -429,7 +429,7 @@ if option1 == '2':
# if we specify to track users, this will replace the INSERTUSERHERE
# with the "TO" field.
if track_email.lower() == "on":
body_new = body_new.replace("INSERTUSERHERE", base64.b64encode(to))
body_new = body_new.replace("INSERTUSERHERE", base64.b64encode(to.encode()))
# send the actual email
time_delay = check_config("TIME_DELAY_EMAIL=").lower()
time.sleep(int(time_delay))