How to Send report through email in Selenium Webdriver

Do you know that we can Send report through email in Selenium Webdriver with small code with help of additional jars?

Today I will show you how you can Send report through email in Selenium Webdriver using simple steps and trust me this is one of the most important features that you should include in your framework as well.

It does not matter which framework you are using it could be Keyword driver, Data driven and Hybrid you should implement email report functionality after test execution.


Send report through email in Selenium Webdriver


Step by Step process to Send report through email in Selenium Webdriver

  1. Download java mail jar file which contains the library to send the email.
  2. download-jar-for-email
  3. Add jar into your project and if you are working with maven project then you can use dependency.
  4. Be ready with the file which you want to send. In our case, it will be Selenium Report.
  5. Write program, which will send the email to the team or a specific person.


Complete program to Send report through email in Selenium Webdriver



Above program will send the report to the respective recipient with the attachment. 

You can also send  the email via Jenkins which is quite easy but you are not using Jenkins then you can use above program.


Important points

1- You can create a custom library which should accept recipients as arguments so that we can reuse this as much we can.

2- Write the logic to get the path of the report, so that we can set the same in our methods.

3- Always call this code after test execution. You can use @AfterSuite of TestNG which run only when complete suite execute.



1- Sending reports after every execution is very important but if you are running multiple tests in one day better to send combined reports at once.

2-Try to keep all screenshot in a common location where everyone will have access so when they click on report and screenshot then it should be accessible.

I hope you liked above article on Send report through email in Selenium Webdriver.

Please try from your side as well and let me know if any thoughts on this.

Sharing knowledge can seem like a burden to some
but on the contrary,
it is a reflection of teamwork and leadership.

So kindly share with your friends and team member.


  1. pooja pilkhwal
  2. Rathish
  3. Duc
  4. Priyaranjan
  5. biswa busan mishra