OAUTH2.0 GMAIL
Doug Easterbrook
doug at artsman.com
Mon Sep 23 16:42:30 UTC 2024
hi Martin.
I don’t have a library for you , but I do have one related suggestion.
you asked:
> it's just best to store emails in the database and mark them as either sent or pending?
I would separate the function of creating emails and sending emails so that you can have restart-ability in case of failure
When creating emails that you want to send, put them in a database with some status like ‘pending’.
then have a separate worker process (or batch function, if you prefer than name instead) that:
— wakes up periodically
— checks for emails that are ‘pending’
— processes and sends them, marking them as ‘done'
— tracks failure if it happens and marks the emails in some sort of ‘error’ status.
benefits of separating the email creation from email sending
- it does not tie up the user’s gui interface
- restartability, as I mention. If the email server goes goes down, you won’t lose emails, they can be retried later
- you can put the batch ‘sending’ process on one machine, typically a server. This has a couple of benefits
— your application can work better behind firewalls if the it people close off certain ports, since you now only need to worry about the one server and not all the workstations and whatever clients do to them
— if you need to do ‘machine’ authentication to a mail server (microsoft and google allow that), then you can manage it for the server and not worry. in other words, it lets you concentrate on one machine.
— people can go back in time and see what they sent.
— you can implement ‘mail undo’ by not sending right away and giving the user a few seconds to change their mind
— you can implement delayed emailing, such as ’send next week at 3:00am’
— you can implement other strategies to work around rate limitation imposed by MS and google such as only xx per minute and delay sending other emails till the next minute or next hour.
— you can prioritize sending emails such as
—— password requests are always sent right now
—— other emails come after that
— you can have mutliple workers running against the same ‘pending’ email list if you need more throughput.
we took this approach and use python libraries to send our email. It is not important that it be python that sends emails. Omnis will do the job with its mailing libraries. We’ve used them in the past.
Our worker runs every 15 seconds — for what its worth and processes up to 50 emails. then repeats. No reason for those numbers, just what we chose.
hope that suggestion helps. and I hope somebody helps you with some emailing example code
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 650-1978
> On Sep 23, 2024, at 2:27 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
>
> Hi all,
> Has anyone managed to setup smtpsend sample library with OAUTH2.0 with a gmail server?
> Question 1: When is it necessary to use Oauth with Gmail?Question 2: Which is the best sample libraries HTTP, IMAP, POP and SMTP to work with gmail?Question 3: Is there a way to setup a complete emailing utility with Omnis so that I can have sent items, incoming emails? Where can I get such a sample library? Or instead, it's just best to store emails in the database and mark them as either sent or pending?
> Any useful leads will be apprieciated.
> Kind regards,Martin Obongita.
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list