# from email.mime.multipart import MIMEMultipart # from email.mime.text import MIMEText # from email.mime.image import MIMEImage import smtplib def send_user_email(): sender="pragnakalp.dev33@gmail.com" password="httscgatatbbxxur" reciever="pragnakalp.dev35@gmail.com" s = smtplib.SMTP('smtp.gmail.com', 587) s.starttls() s.login(sender,password) message = """Subject : Appointment Booking\n\n Hello, Your OCR generated successfully""" s.sendmail(sender, reciever, message) s.quit() mailsend=1 print("Send mail successfully") return "Hellowwass" fromadd = "pragnakalp.dev33@gmail.com" password = "httscgatatbbxxur" # SENDGRID_API_KEY = "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" # def gmail_login(): # try: # server = smtplib.SMTP('smtp.gmail.com', 587) # server.starttls() # server.login(fromadd, password) # return server # except Exception as e: # print("*** MAIL ERROR ***"*10) # print(e) # def send_user_email(hostname,text_output,Method): # try: # # attachment = input_img # html_body="" # html_body = f""" # #

# {hostname}
# Method: {Method}
# Generated text: {text_output}
#

#
# # """ # toadd = "pragnakalp.dev35@gmail.com" # subject = "OCR generated text" # msg = MIMEMultipart("alternative") # msg['From'] = fromadd # msg['To'] = toadd # msg['Subject'] = subject # # part1 = MIMEText(text, "plain") # # part2 = MIMEText(html_body, "html") # # msg.attach(part1) # # part2 = MIMEText('%s

' % (html_body, attachment), 'html') # part2 = MIMEText(html_body, "html") # msg.attach(part2) # # with open(attachment, 'rb') as fp: # # img = MIMEImage(fp.read()) # # img.add_header('Content-ID', '<{}>'.format(attachment)) # # msg.attach(img) # server = gmail_login() # print("login success") # temp = server.sendmail(fromadd, toadd, msg.as_string()) # print("temp=.", temp) # print("email sent to", toadd) # print("** Mail Successfully Sent !***") # return True # except Exception as e: # print("Error while sending feedback email => ", e) # return False