providercreate an smtp object by calling smptlib smtp()passing the domain name as string argumentand passing the port as an integer argument the smtp object represents connection to an smtp mail server and has methods for sending emails for examplethe following call creates an smtp object for connecting to an imaginary email serversmtpobj smtplib smtp('smtp example com' type(smtpobjentering type(smtpobjshows you that there' an smtp object stored in smtpobj you'll need this smtp object in order to call the methods that log you in and send emails if the smptlib smtp(call is not successfulyour smtp server might not support tls on port in this caseyou will need to create an smtp object using smtplib smtp_ssl(and port instead smtpobj smtplib smtp_ssl('smtp example com' note if you are not connected to the internetpython will raise socket gaierror[errno getaddrinfo failed or similar exception for your programsthe differences between tls and ssl aren' important you only need to know which encryption standard your smtp server uses so you know how to connect to it in all of the interactive shell examples that followthe smtpobj variable will contain an smtp object returned by the smtplib smtp(or smtplib smtp_ssl(function sending the smtp "hellomessage once you have the smtp objectcall its oddly named ehlo(method to "say helloto the smtp email server this greeting is the first step in smtp and is important for establishing connection to the server you don' need to know the specifics of these protocols just be sure to call the ehlo(method first thing after getting the smtp object or else the later method calls will result in errors the following is an example of an ehlo(call and its return valuesmtpobj ehlo(( 'mx example com at your service ]\nsize bitmime\nstarttls\nenhancedstatuscodes\nchunking'if the first item in the returned tuple is the integer (the code for "successin smtp)then the greeting succeeded starting tls encryption if you are connecting to port on the smtp server (that isyou're using tls encryption)you'll need to call the starttls(method next this required