title: Sending mail with attachment in Python after Robot Framework test execution
body: <p>i have managed to send mail with test results via robotemail.py script but i want to add attachment (log.html) into mail but i fail to do that. Can anybody help me?</p>
  <p>here is the script:</p>
  <pre><code>
      #!/usr/bin/python
      import smtplib
      import email.message
      import mimetypes
      import sys
      import os
      import math
      from datetime import datetime
      from datetime import timedelta
      from robot.api import ExecutionResult, ResultVisitor
      from email.message import EmailMessage
      
      # ======= START OF EMAIL SETUP CONTENT ====== #
      
      # email set-up
      server = smtplib.SMTP('XXXXXX')
      msg = email.message.Message()
      msg['Subject'] = 'smoke test'
      
      sender = 'noreply@XXXXX.com'
      recipients = ['XXXX@XXXXX.com']
      
      msg['From'] = sender
      msg['To'] = &quot;, &quot;.join(recipients)
      password = &quot;XXXXXX&quot;
      msg.add_header('Content-Type', 'text/html')
   
  </code></pre>
  <blockquote>
  <p>I suppose here is the space for adding attachment code</p>
  </blockquote>
  <pre><code>    # ======= END OF EMAIL SETUP CONTENT ====== #
      
   
  
  **I have excluded big chunk of code**
  
     
      
      # ====== EMAIL CONTENT ========== #
      
      email_content = &quot;&quot;&quot;
       XXXXXXXXXXXXXXX
      &quot;&quot;&quot; % (total_suite, passed_suite, failed_suite, suitepp, total, passed, failed, testpp, total_keywords, passed_keywords,
             failed_keywords, kwpp, elapsedtime, generator)
      
      msg.set_payload(email_content)
      
      # Start server
      server.starttls()
      
      # Login Credentials for sending the mail
      server.login(msg['From'], password)
      
      server.sendmail(sender, recipients, msg.as_string())
      
      # ==== END OF EMAIL CONTENT ====== #
  
  </code></pre>
  <p>Can anybody help me?</p>