# Improving the email notification system in ScholarX platform

**URL:** <https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255>\
**Category:** ScholarX\
**Created:** [April 26, 2021, 12:20pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255 "2021-04-26T12:20:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dilshan\_Naveen](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/dilshan_naveen/32/519_2.png) [@Dilshan\_Naveen](https://sef.discourse.group/u/Dilshan_Naveen)\
**Post date:** [April 26, 2021, 12:20pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/1 "2021-04-26T12:20:58Z")

</div>

When the Current system needs to send email notifications it waits until all emails deliver then send’s the response to the front-end, the problem is it takes at least 5 seconds to send an email to one email account and get a response if there are 500 accounts to send it will take at least 41 minutes to get a response from the server.

These are the possible alternatives I found to overcome the above problem.

1. Sendgrid or another email service that provides an API (instead of SMTP)
2. Multi-threading

Using an email service like Sendgrid will reduce this problem and improve server performance because it uses API calls instead of SMTP. However, there is a daily threshold in most of the services (in free versions). It’s 500 per day in Send grid. There’s a possibility that we might exceed that limit because ScholarX sends bulk emails when there’s a state change. Therefore, it might not a good solution to address the problem.

If we use multi-threading it will improve the response speed of the same implementation. I’ve implemented a thread into a single state as a proof of concept. Here are the results,

The current response speed of the current implementation,

 ![IMG-3](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/ca74e055e5639809cf8213cc5367867d611b204b.png)

If we use Threads,

 ![IMG-3](https://global.discourse-cdn.com/free1/uploads/sef/original/1X/d3ecd205683db2cc5a19d6b9e22f8a8c23c36d5b.png)

I tested these with three accounts registered as mentors for both scenarios, it took around 17.87 seconds to get a response from the server, after I added a separate thread to send emails, it only took 40.1ms to get repones from the server, according to these results, if we use multithreading in the current implementation, it will improve the response speed of the current implementation by 97.6471%.

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 26, 2021, 12:24pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/2 "2021-04-26T12:24:53Z")

</div>

This is impressive!!

+500 from me!

Hey, [@EngTeam](https://sef.discourse.group/groups/engteam) look at this! 🥳

---

<div class="post-metadata">

**Author:** ![akshika47](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/akshika47/32/993_2.png) [@akshika47](https://sef.discourse.group/u/akshika47)\
**Post date:** [April 26, 2021, 12:33pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/3 "2021-04-26T12:33:04Z")

</div>

OMG! This is quite impressive.

---

<div class="post-metadata">

**Author:** ![Gravewalker](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/gravewalker/32/12_2.png) [@Gravewalker](https://sef.discourse.group/u/Gravewalker)\
**Post date:** [April 26, 2021, 12:40pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/4 "2021-04-26T12:40:04Z")

</div>

WOW, This is amazing @Dilshan_Naveen  
😍  
Waiting for the PR, Itching to test the app with these performances

---

<div class="post-metadata">

**Author:** ![anjisvj](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/anjisvj/32/9_2.png) [@anjisvj](https://sef.discourse.group/u/anjisvj)\
**Post date:** [April 26, 2021, 12:46pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/5 "2021-04-26T12:46:02Z")

</div>

This is wonderful @Dilshan_Naveen Good job! 🙌

---

<div class="post-metadata">

**Author:** ![Dilshan\_Naveen](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/dilshan_naveen/32/519_2.png) [@Dilshan\_Naveen](https://sef.discourse.group/u/Dilshan_Naveen)\
**Post date:** [April 26, 2021, 12:57pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/6 "2021-04-26T12:57:19Z")

</div>

[@DevTeam](https://sef.discourse.group/groups/devteam), thanks everyone

---

<div class="post-metadata">

**Author:** ![Dilshan\_Naveen](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/dilshan_naveen/32/519_2.png) [@Dilshan\_Naveen](https://sef.discourse.group/u/Dilshan_Naveen)\
**Post date:** [April 26, 2021, 1:23pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/7 "2021-04-26T13:23:44Z")

</div>

> <https://github.com/sef-global/scholarx/pull/133>
>
> \## Purpose
> When the Current system needs to send email notifications it waits u…ntil all emails deliver then send’s the response to the front-end, the problem is it takes at least 5 seconds to send an email to one email account and get a response if there are 500 accounts to send it will take at least 41 minutes to get a response from the server.
> 
> \## Goals
> Improve the response speed from the backend to the frontend.
> 
> \## Approach
> Created a separate thread for the email sending process.
> 
> \### Screenshots
> !\[image\](https://user-images.githubusercontent.com/29551090/116088092-2b477600-a6bf-11eb-8f14-e52309fc2398.png)
>   
> \### Preview Link
> https://pr-{PR\_NUMBER}-sef-site.surge.sh/
> 
> \## Checklist
> \- \[x\] This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
> \- \[x\] I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
> \- \[x\] My code follows the style guidelines of this project
> \- \[x\] I have performed a self-review of my own code
> \- \[\] I have commented my code, particularly in hard-to-understand areas
> \- \[\] I have made corresponding changes to the documentation
> 
> \## Related PRs
> \<!--- List any other related PRs --\> 
> 
> \## Test environment
> - Computer: MacBook Pro 13inch 2020
> - OS: macOS Big Sur
> - Browser: safari

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 26, 2021, 1:35pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/8 "2021-04-26T13:35:48Z")

</div>

Thanks for getting this done, @Dilshan_Naveen! Could you please point the PR to the “development” branch?

---

<div class="post-metadata">

**Author:** ![Dilshan\_Naveen](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/dilshan_naveen/32/519_2.png) [@Dilshan\_Naveen](https://sef.discourse.group/u/Dilshan_Naveen)\
**Post date:** [April 26, 2021, 1:39pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/9 "2021-04-26T13:39:29Z")

</div>

sure @jaye, can you check now

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 27, 2021, 9:28am UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/10 "2021-04-27T09:28:50Z")

</div>

Excellent work, Dilshan! We’re fortunate to have an innovator and creative such as you in our midst. I believe your work will bring joy to many people in the future through ScholarX! 🤗

---

<div class="post-metadata">

**Author:** ![Dilshan\_Naveen](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/dilshan_naveen/32/519_2.png) [@Dilshan\_Naveen](https://sef.discourse.group/u/Dilshan_Naveen)\
**Post date:** [April 27, 2021, 6:20pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/11 "2021-04-27T18:20:29Z")

</div>

Thanks, @jaye 😀😀😀

---

<div class="post-metadata">

**Author:** ![jaye](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/jaye/32/810_2.png) [@jaye](https://sef.discourse.group/u/jaye)\
**Post date:** [April 27, 2021, 6:22pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/12 "2021-04-27T18:22:25Z")

</div>

Welcome, Dilshan!

Make sure to write a blog on what you have done.

> [@Personal Blog updates of our Developers](https://sef.discourse.group/t/personal-blog-updates-of-our-developers/126/):
>
> Hi all, We(Tech team) have decided to publish all our developer’s blog posts in this thread. We highly recommend your contribution to post new posts and supporting the existing posts as it will help you a lot to learn from other’s experiences.

---

<div class="post-metadata">

**Author:** ![Dilshan\_Naveen](https://yyz2.discourse-cdn.com/free1/user_avatar/sef.discourse.group/dilshan_naveen/32/519_2.png) [@Dilshan\_Naveen](https://sef.discourse.group/u/Dilshan_Naveen)\
**Post date:** [April 27, 2021, 6:24pm UTC](https://sef.discourse.group/t/improving-the-email-notification-system-in-scholarx-platform/255/13 "2021-04-27T18:24:12Z")

</div>

> [@Personal Blog updates of our Developers](https://sef.discourse.group/t/personal-blog-updates-of-our-developers/126/1):
>
> his thread. We highly recommend your contribution to post new posts and supporting the existing posts as it will help you a lot to learn from other’s experiences.

already working on that ! 😀😀😀😀
