rauldpm / ChatbotTFG

This project houses a chatbot built with the Open Source Rasa software.
GNU General Public License v3.0
0 stars 0 forks source link

Add booking email confirmation #14

Closed rauldpm closed 1 year ago

rauldpm commented 2 years ago

This issue aims to add a confirmation via email of the reservation made by the user. This could be done by asking the user for a contact email where to send a summary of the reservation using postman.

rauldpm commented 1 year ago

Update report

image

rauldpm commented 1 year ago

Update report

code = str(random.randint(100000,999999))

port = 587
server = "smtp.gmail.com"
sender = sender
recipient = reserva_email
password = "APP_PASSWORD"

msg = MIMEMultipart()
message = "Hello!\n"
message += "Your reservation code is: " + code

msg['From'] = sender
msg['To'] = recipient
msg['Subject'] = "Restaurant reservation code"
msg.attach(MIMEText(message, "plain"))
text = msg.as_string()
SSLcontext = ssl.create_default_context()

with smtplib.SMTP(server, port) as server:
    server.starttls(context=SSLcontext)
    server.login(sender, password)
    server.sendmail(sender, recipient, text)

image

rauldpm commented 1 year ago

Update report

image

image