A Non-blocking “Email sending” functionality in Scala

Table of contents
Reading Time: < 1 minute

In our last blog “Adding an Email Sending Functionality in Play using Scala” we explained how to include an Email sending functionality in a Play Scala Application. But the way in which we implemented it, made it a Blocking one i.e., application will wait until email has been sent.

In this blog we will explain, how to make the Email Sending functionality a Non-blocking one. By making it non-blocking, the application will not wait until email is sent & will move on to the next step.

To make this functionality a Non-Blocking one, just make following changes in the mailSendingApp we posted earlier:-

1) Import following packages in Application.scala file


2) Add following code to Application.scala file


Note – To download the App with changes just click here.

Written by 

Himanshu Gupta is a software architect having more than 9 years of experience. He is always keen to learn new technologies. He not only likes programming languages but Data Analytics too. He has sound knowledge of "Machine Learning" and "Pattern Recognition". He believes that best result comes when everyone works as a team. He likes listening to Coding ,music, watch movies, and read science fiction books in his free time.

2 thoughts on “A Non-blocking “Email sending” functionality in Scala1 min read

  1. Note that this is not non-blocking, but simply asynchronous. Whichever thread ends up running the ‘sendEmail’ function still blocks.

Comments are closed.