Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import smtplib # implements the SMTP protocol to be able to send emails
""" sends an email to new users with the details of the account
https://www.geeksforgeeks.org/send-mail-gmail-account-using-python/
"""
def email(nick, password, mail):
try:
server = smtplib.SMTP('smtp.gmail.com', 587) #declaration of gmail SMTP server settings
server.starttls() #For security, this start the SMTP connection in the Transport Layer Security mode that encrypts all the SMTP commands
server.login("theforeignersgroup@gmail.com", "wearethebest101") #information of the account which will send the email
msg = "Thank you for joining our CHATBOT!\nDont lose these email.\nYour account details to access our " \
"chatbot:\nLogin Username: " + nick + "\nPassword: " + password
server.sendmail("theforeignersgroup@gmail.com", mail, msg)
server.quit() #closes the SMTP session
except:
print("Something went wrong. Probably your wiki connection it is not the best for this service")
""" Allows the user to send emails to everyone he wants, using our email"""
def create_email():
try:
server = smtplib.SMTP('smtp.gmail.com', 587) #declaration of gmail SMTP server settings
server.starttls() #For security, this start the SMTP connection in the Transport Layer Security mode that encrypts all the SMTP commands
mail = input("Email: ")
server.login("theforeignersgroup@gmail.com", "wearethebest101") #information of the account which will send the email
msg = input("Message: ")
server.sendmail("theforeignersgroup@gmail.com", mail, msg)
server.quit() #closes the SMTP session
print("Done! What can I help you now?")
except:
print("Something went wrong. Probably your wifi connection it is not the best for email confirmation or the email is wrong.")