Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make an app that sends email in python

import smtplib
import random
from email.message import EmailMessage


subject = input("Subject: ")
body = input("Text: ")
to = input("Send to: ")



if __name__ == '__main__':
    msg = EmailMessage()
    msg.set_content(body)
    msg['subject'] = subject
    msg['to'] = to


    sender = input("Sender: ")
    print("""To know your app password which you'll need you need to go to your sender gmail's account 
then click on the account icon on the top right then chose manage your account 
and chose security then go to signing to google and activate 2 step verification 
after filling the information needed go back to the same page and click on app passwords 
click select and choose other and type email then click done and save your app password
    """)
    password  = input("App password: ")
    msg['from'] = sender

    server = smtplib.SMTP("smtp.gmail.com", 587)
    server.starttls()
    server.login(sender, password)
    server.send_message(msg)

    server.quit()

    print("Email sent")


Comment

PREVIOUS NEXT
Code Example
Python :: Generate bootstrap replicate of 1D data that return a particular operation on a range 
Python :: python scatter matrix with regression line 
Python :: translating the mean of a data to a specific value 
Python :: assemblyai 
Python :: python string count complexity 
Python :: genrate requirments.txt pytohn 
Python :: x and y in python 
Python :: matplotlib no gui 
Python :: convert to category data type 
Python :: how can i get the n values by space separated with condition in python 
Python :: NMF cosine similarities 
Python :: como colocar uma variavel no print python 
Python :: traint test split on column id 
Python :: python sort by last name using lambda 
Python :: how to choose appropriate graph for dataset visualization 
Python :: trivia python game 
Python :: update value in xml python 
Python :: Create multiple lists with defined shape filled with 0 
Python :: How to Use the abs() Function with a Complex Number Argument 
Python :: imoport python code 
Python :: pandas set index integer not float 
Python :: how to import discord in python rewrite vscode 
Python :: spacy vietnamese 
Python :: schedule a function python inside tkinter loop 
Python :: python script superuser 
Python :: reportlab drawimage issues with png transparency background 
Python :: how to wirte something 100 times with python 
Python :: You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P. 
Python :: in python how to end the code after 10 input 
Python :: groupby fillna ffill 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =