I am creating an app that sends and receives emails through different hosting providers IMAP + Office + Gmail. Now the problem that I am facing is that a user can send an email at any point of time irrespective of the background job is syncing after a specific
interval. So for example
The user send's an email 3:12 PM and meanwhile, the job is scheduled for 3:14 PM. Now as of the UX experience I have to show the user immediately that email is sent and should be displayed in the respective folders in our application.
Now, what should I do should the sent email be inserted in the database immediately and then later on when job runs we check if this email is already in the system.
If I understood you want to know immediately when your app is receiving a mail? For most mail providers you should be able to use a "webhook" that will trigger an http request to your system when a mail is received. It is still a bit surprising that your
app seems to receive mails using multiple providers rather than having to monitor a single mailbox ?
Make sure about the delay between receiving the mail and having your app processing this mail is really that critical. You are checking mails how often currently?
Most email systems have a pending folder (outbox) email sits in until they are sent. Normally you assign a message ID to the email so you can track it.
If I understood you want to know immediately when your app is receiving a mail? For most mail providers you should be able to use a "webhook" that will trigger an http request to your system when a mail is received. It is still a bit surprising that your
app seems to receive mails using multiple providers rather than having to monitor a single mailbox ?
Make sure about the delay between receiving the mail and having your app processing this mail is really that critical. You are checking mails how often currently?
Hello,
Thanks for your reply.
Sorry, you got me wrong. Basically we are already syncing the mailbox through Gmail history API same goes for Office history API and the same goes for SMTP. Now the problem there are chances that some of the data is synced early and rest is synced later
so to illustrate what I am talking about pay attention to the below scenario.
We have a job scheduled that sync the mailbox after every 2 minutes now Office and Gmail Now for example on 10:11 PM server synced the Mailbox now it is scheduled for 10:13 PM between 10:11 PM and 10:13 PM a user opened the application and composed an email
now email is sent either through Gmail or Office. When the email is sent now my concern is that do I need to sync the mailbox at that time or I have to wait for a scheduled job to sync the Sent and Inbox folder.
Now if I wait for the job to sync the data then I cannot show the mail immediately in our sent mail folder in the application.
That’s why you need to implement an “outbox”. All client email system have this issue. There is a delay between the client clicking send, and the mail system ability to deliver to the first server in the chain. This state is usually represented as outbox,
while the client is waiting to send.
Thanks for answering this really helped. I would like to know further about syncing the email.
So let's take the scenario where we are syncing the mailboxes of each user. Now we have one .NET Core background service syncing Office emails and also there might be chances that one account has received so many emails that it is blocking the other users
to be synced. Now Ef Core is not thread safe because during sync we do require refreshing access token several time so those changes has to be stored back in the database.
Assume these figures
10 Office Mail Account being synced after 2 minutes
1-5 Accounts have 230 mails that are to be synced back and forth
6-10 have significantly less number of emails in the queue.
What should be the best way of handling this having maximum performance and don't let user delay their mailbox sync.
I have got a solution to my problem which to have Coravel installed and use coravel Invocable and within a service worker all the email should be invoked so they run on their separate thread.
hasnihaider
Thanks for answering this really helped. I would like to know further about syncing the email.
So let's take the scenario where we are syncing the mailboxes of each user. Now we have one .NET Core background service syncing Office emails and also there might be chances that one account has received so many emails that it is blocking the other users
to be synced. Now Ef Core is not thread safe because during sync we do require refreshing access token several time so those changes has to be stored back in the database.
Assume these figures
10 Office Mail Account being synced after 2 minutes
1-5 Accounts have 230 mails that are to be synced back and forth
6-10 have significantly less number of emails in the queue.
What should be the best way of handling this having maximum performance and don't let user delay their mailbox sync.
Member
1 Points
15 Posts
Suggestion Needed: Syncing Mailbox through API
May 19, 2020 10:14 AM|hasnihaider|LINK
Hello,
I am creating an app that sends and receives emails through different hosting providers IMAP + Office + Gmail. Now the problem that I am facing is that a user can send an email at any point of time irrespective of the background job is syncing after a specific interval. So for example
The user send's an email 3:12 PM and meanwhile, the job is scheduled for 3:14 PM. Now as of the UX experience I have to show the user immediately that email is sent and should be displayed in the respective folders in our application.
Now, what should I do should the sent email be inserted in the database immediately and then later on when job runs we check if this email is already in the system.
Regards
All-Star
48530 Points
18075 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 19, 2020 12:35 PM|PatriceSc|LINK
Hi,
If I understood you want to know immediately when your app is receiving a mail? For most mail providers you should be able to use a "webhook" that will trigger an http request to your system when a mail is received. It is still a bit surprising that your app seems to receive mails using multiple providers rather than having to monitor a single mailbox ?
For example you have https://developers.google.com/gmail/api/guides/push or https://docs.microsoft.com/en-us/graph/webhooks
Make sure about the delay between receiving the mail and having your app processing this mail is really that critical. You are checking mails how often currently?
All-Star
58204 Points
15661 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 19, 2020 02:37 PM|bruce (sqlwork.com)|LINK
Most email systems have a pending folder (outbox) email sits in until they are sent. Normally you assign a message ID to the email so you can track it.
Member
1 Points
15 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 20, 2020 05:26 AM|hasnihaider|LINK
Hello,
Thanks for your reply.
Sorry, you got me wrong. Basically we are already syncing the mailbox through Gmail history API same goes for Office history API and the same goes for SMTP. Now the problem there are chances that some of the data is synced early and rest is synced later so to illustrate what I am talking about pay attention to the below scenario.
We have a job scheduled that sync the mailbox after every 2 minutes now Office and Gmail Now for example on 10:11 PM server synced the Mailbox now it is scheduled for 10:13 PM between 10:11 PM and 10:13 PM a user opened the application and composed an email now email is sent either through Gmail or Office. When the email is sent now my concern is that do I need to sync the mailbox at that time or I have to wait for a scheduled job to sync the Sent and Inbox folder.
Now if I wait for the job to sync the data then I cannot show the mail immediately in our sent mail folder in the application.
All-Star
58204 Points
15661 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 20, 2020 02:47 PM|bruce (sqlwork.com)|LINK
That’s why you need to implement an “outbox”. All client email system have this issue. There is a delay between the client clicking send, and the mail system ability to deliver to the first server in the chain. This state is usually represented as outbox, while the client is waiting to send.
Member
98 Points
326 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 20, 2020 05:33 PM|InspiredJide|LINK
True I totally agree with you bruce. This means that a mail might be in outbox and it still waiting for a send action right.
Member
1 Points
15 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 21, 2020 08:08 AM|hasnihaider|LINK
Thanks for answering this really helped. I would like to know further about syncing the email.
So let's take the scenario where we are syncing the mailboxes of each user. Now we have one .NET Core background service syncing Office emails and also there might be chances that one account has received so many emails that it is blocking the other users to be synced. Now Ef Core is not thread safe because during sync we do require refreshing access token several time so those changes has to be stored back in the database.
Assume these figures
10 Office Mail Account being synced after 2 minutes
1-5 Accounts have 230 mails that are to be synced back and forth
6-10 have significantly less number of emails in the queue.
What should be the best way of handling this having maximum performance and don't let user delay their mailbox sync.
Member
1 Points
15 Posts
Re: Suggestion Needed: Syncing Mailbox through API
May 22, 2020 11:46 AM|hasnihaider|LINK
I have got a solution to my problem which to have Coravel installed and use coravel Invocable and within a service worker all the email should be invoked so they run on their separate thread.