internet application programming smtp([host [port]]creates an object representing connection to an smtp server if host is givenit specifies the name of the smtp server port is an optional port number the default port is if host is suppliedthe connect(method is called automatically otherwiseyou will need to manually call connect(on the returned object to establish the connection an instance of smtp has the following methodss connect([host [port]]connects to the smtp server on host if host is omitteda connection is made to the local host ( 'port is an optional port number that defaults to if omitted it is not necessary to call connect(if host name was given to smtp( login(userpasswordlogs into the server if authentication is required user is usernameand password is password quit(terminates the session by sending 'quitcommand to the server sendmail(fromaddrtoaddrsmessagesends mail message to the server fromaddr is string containing the email address of the sender toaddrs is list of strings containing the email addresses of recipients message is string containing completely formatted rfc- compliant message the email package is commonly used to create such messages it is important to note that although message can be given as text stringit should only contain valid ascii characters with values in the range to otherwiseyou will get an encoding error if you need to send message in different encoding such as utf- encode it into byte string first and supply the byte string as message example the following example shows how the module can be used to send messageimport smtplib fromaddr "someone@some comtoaddrs ["recipient@other com"msg "from% \ \nto% \ \ \ \ (fromaddr",join(toaddrs)msg +""refinance your mortgage to buy stocks and viagra""server smtplib smtp('localhost'server sendmail(fromaddrtoaddrsmsgserver quit(urllib package the urllib package provides high-level interface for writing clients that need to interact with http serversftp serversand local files typical applications include scraping data from web pagesautomationproxiesweb crawlersand so forth this is one of the most highly configurable library modulesso every last detail is not presented here insteadthe most common uses of the package are described lib fl ff