This article example describes the python implementation of the send email function. Shared for your reference, as follows:
I. Introduction
This application realizes sending emails to Netease mailbox
II Code
import smtplib import tkinter class Window: def __init__(self,root): label1 = (root,text='SMTP') label2 = (root,text='Port') label3 = (root,text='Username') label4 = (root,text='Password') label5 = (root,text='Recipient') label6 = (root,text='Theme') label7 = (root,text='From') (x=5,y=5) (x=5,y=30) (x=5,y=55) (x=5,y=80) (x=5,y=105) (x=5,y=130) (x=5,y=155) = (root) = (root) = (root) = (root,show = '*') = (root) = (root) = (root) (,'25') (x=50,y=5) (x=50,y=30) (x=50,y=55) (x=50,y=80) (x=50,y=105) (x=50,y=130) (x=50,y=155) = (root,text='Send Mail',command = ) (x=60,y=180) =(root) (y=220) def Get(self): try: host = () port =int(()) user = () pw = () fromaddr = () toaddr=() subject=() text = (1.0,) msg =("From:%s\nTo:%s\nSubject:%s\n\n" % (fromaddr,toaddr,subject)) msg = msg+text smtp=(host,port) smtp.set_debuglevel(1) (user,pw) (fromaddr,toaddr,msg) () except Exception as e: (,'Send error \n') root =() window=Window(root) (600,400) ()
III. Operational results
More about Python related content can be viewed on this site's topic: thePython Socket Programming Tips Summary》、《Python Data Structures and Algorithms Tutorial》、《Summary of Python function usage tips》、《Summary of Python string manipulation techniques》、《Python introductory and advanced classic tutorialsand theSummary of Python file and directory manipulation techniques》
I hope that what I have said in this article will help you in Python programming.