LiamMahoney / online-impact

Website for Online Impact
https://online-impact.vercel.app
0 stars 0 forks source link

Contact Form #5

Closed LiamMahoney closed 1 year ago

LiamMahoney commented 1 year ago

Original message:

Then at the bottom have a contact form labeled, “Work With Us” (If possible)

Personal Information (subheader text) First Name Email

Business Information Business Name Website

TODO:

LiamMahoney commented 1 year ago

I think I want to try and crate a dynamic form component. Form would keep track of all the input children, handle submissions.

LiamMahoney commented 1 year ago

Possible states of a form's input:

  1. no input provided 2.partial (invalid) input provided before form has been submitted
  2. valid input provided before / with submission
  3. invalid input provided with submission
  4. partial / invalid input fixed (no longer invalid) before nth submission

missing any?

LiamMahoney commented 1 year ago

Actually I need to stop being dumb and try to use HTML forms

LiamMahoney commented 1 year ago

Left off working on implementing form notifications.

TODO:

LiamMahoney commented 1 year ago

Sending Email

Google API Console

Service Account generated

Believe I have nodemailer setup properly but getting the following error when trying to send an email.

Error: Missing credentials for "PLAIN"
    at SMTPConnection._formatError (/Users/liam/Documents/code/web/websites/online_impact/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)

Turns out I had been providing the wrong value for the type of the auth object in the nodemailer Transport object..


        let transporter = nodemailer.createTransport({
            host: 'smtp.gmail.com',
            port: 465,
            secure: true,
            auth: {
                type: "OAuth2",
                user: process.env.USER_EMAIL,
                serviceClient: process.env.SVC_ACCT_CLIENT,
                privateKey: fs.readFileSync(process.env.SVC_ACCT_PRIV_KEY)
            }
        });

But now getting authentication error -

Error: unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.
LiamMahoney commented 1 year ago

Took me way longer than it should've. Ended up with what feels like a janky solution but it should work fine.

  1. generate app password (https://support.google.com/accounts/answer/185833?sjid=11737995041473616078-NA)
  2. use node mailer with app password