code: def create_message(from_addr, to_addr, subject, body, encoding=None):
      
      if encoding == "None":
          encoding = None
      if not encoding:
          encoding = 'utf-8'
      msg = MIMEText(body.encode(encoding), 'plain', encoding)
      msg['Subject'] = Header(subject.encode(encoding), encoding)
      msg['From'] = from_addr
      msg['To'] = to_addr
      msg['Date'] = formatdate()
      return msg
docs: Create message object for sending email
  
      Parameters
      ----------
      from_addr : string
          An email address used for 'From' attribute
      to_addr : string
          An email address used for 'To' attribute
      subject : string
          An email subject string
      body : string
          An email body string
      encoding : string
          An email encoding string (Default: utf8)
  
      Returns
      -------
      object
          An instance of email.mime.text.MIMEText