title: Automate the send email test report of test cases using selenium and python
body: <p>How do i automate send email test report to recipient from selenium webdriver using python. I'm currently using pycharm IDE to automate test cases.
  I want send email to someone at last when this test case ran by me. Mail should have success and failed count. I tried to find the solution but failed.This is my test case. Please give me the solution.</p>
  
  <pre><code>from selenium import webdriver
  from generic_functions.FindElement import HandyWrappers
  from generic_functions.takescreenshots import Screenshot
  from generic_functions.error_handle import CatchExceptions
  import os
  import time
  import unittest
  
  class TestHome(unittest.TestCase):
  driverLocation = "C:\\Users\\Sales\\Desktop\\Automation\\ABCD\\libs\\chromedriver.exe"
  os.environ["webdriver.chrome.driver"] = driverLocation
  driver = webdriver.Chrome(driverLocation)
  driver.maximize_window()
  driver.implicitly_wait(10)    
  
  def test_home(self):
      try:
          baseURL = "https://portal.abcd.com"
          driver = self.driver
          driver.get(baseURL)
          hw = HandyWrappers(driver)
  
          # regionLogin
          username = hw.getElement(".//form[@id='login-form']/fieldset/section[1]/label[2]/input[@name='email']",
                                   locatorType="xpath")
          username.send_keys("abcd@live.com")
          time.sleep(2)
  
          password = hw.getElement(".//form[@id='login-form']/fieldset/section[2]/label[2]/input[@name='password']",
                                   locatorType="xpath")
          password.send_keys("abcd")
  
          signIn = hw.getElement(".//form[@id='login-form']/footer/button[contains(text(),'Sign in')]",
                                 locatorType="xpath")
          signIn.click()
          Screenshot.takeScreenshot(driver)
          # endregion
          time.sleep(2)
  
          driver.execute_script("window.scrollBy(0,300);")
          time.sleep(1)
          # Switch to Iframe from main page
          driver.switch_to.frame("ifrmClaimSummary")
  
          # regionScrolling Right and left
          driver.execute_script("window.scrollBy(100,0);")
          time.sleep(1)
          driver.execute_script("window.scrollBy(100,0);")
          time.sleep(1)
          driver.execute_script("window.scrollBy(100,0);")
          time.sleep(1)
  
          # Scrolling Left
          driver.execute_script("window.scrollBy(-100,0);")
          time.sleep(1)
          driver.execute_script("window.scrollBy(-100,0);")
          time.sleep(1)
          driver.execute_script("window.scrollBy(-100,0);")
          time.sleep(1)
          # endregion
  
          driver.switch_to.default_content()
          driver.execute_script("window.scrollBy(0,-300);")
          time.sleep(2)
          driver.quit()
  
      except Exception:
          CatchExceptions.PrintException()
          Screenshot.takeScreenshot(driver)
  
  
  if __name__ == '__main__':
  unittest.main()
  </code></pre>