although you can create any sort of an -mail message with pythonthe easiest type to create is one that contains plain text the lack of formatting in the content lets you focus on the technique used to create the messagerather than on the message content the following steps help you understand how the message-creating process worksbut you won' actually send the message anywhere open python shell window you see the familiar python prompt type the following code (pressing enter after each line)from email mime text import mimetext msg mimetext("hello there"msg['subject'" test messagemsg['from']='john mueller msg['to''john mueller this is basic plain-text message before you can do anythingyou must import the required classwhich is mimetext if you were creating some other sort of messageyou' need to import other classes or import the email mime module as whole the mimetext(constructor requires message text as input this is the body of your messageso it might be quite long in this casethe message is relatively short -just greeting at this pointyou assign values to standard attributes the example shows the three common attributes that you always definesubjectfromand to the two address fieldsfrom and tocontain both human-readable name and the -mail address all you have to include is the -mail address type msg as_stringand press enter you see the output shown in figure - this is how the message actually looks if you have ever looked under the covers at the messages produced by your -mail applicationthe text probably looks familiar the content-type reflects the kind of message you createdwhich is plain-text message the charset tells what kind of characters are used in the message so that the recipient knows how to handle them the mime-version specifies the version of mime used to create the message so that the recipient knows whether it can handle the content finallythe context-transfer-encoding determines how the message is converted into bit stream before it is sent to the recipient