Closed AbhiAgarwal closed 7 years ago
is this https://tabulae.newsai.org/api/email-settings/:personId/verify
or a diff id?
It's the emailsetting ID from users me
The field emailsetting in users/me. If you put that in email-settings/that id/verify
https://tabulae.newsai.org/api/email-settings
Sample POST to add SMTP/IMAP settings:
You can tell the user to find this from their email provider (if they use Hotmail or Yahoo Mail or Godaddy they can just Google Godaddy SMTP settings or Godaddy IMTP settings).
Keep the ID that this returns. You'll find this ID in the
/users/me
as fieldemailsetting
.Sample POST to add username/password for email:
POST to
https://tabulae.newsai.org/api/email-settings/add-email
Ask the user for the email and password. This email doesn't necessarily have to be their (
email
). It'll send from this address. You can enforce it on the front end for it to be their email. So just be like the user isabhi@newsai.org
. And ask them to enter their password. Tell them we won't read their emails, etc. same as gmail.(You usually wouldn't use Gmail SMTP - you'd have something else, but I only had my private email SMTP). I added this as an example.
After both of these have been added. You can verify if the username/password & connection is valid:
Something like:
https://tabulae.newsai.org/api/email-settings/5764952132419584/verify
.This will return a status true or false and an error message. Show the user the error message if it returns false.
If it comes back true, then it'll switch on the boolean flag
"smtpvalid": true,
in/users/me
.After this is complete and smptvalid is true. Now you can do a PATCH to the user to set the
externalemail
field for a user to be true. Now, the user will be sending emails through the SMPT rather than through SendGrid or Gmail.One thing to note: don't let the user have both gmail and smtp on at the same time. It won't really matter - if you have both on it won't cause bugs. But, if they have gmail already enabled don't let them use SMTP and if they have SMTP don't let them use gmail.