Skip to content

Added contact form support in backend - #146

Open
MeleMannen wants to merge 6 commits into
mainfrom
144-create-a-new-send-email-route-that-sends-an-email-from-noreplyvektorprogrammetno-to-an-email-address
Open

MeleMannen wants to merge 6 commits into
mainfrom
144-create-a-new-send-email-route-that-sends-an-email-from-noreplyvektorprogrammetno-to-an-email-address

Conversation

@MeleMannen

@MeleMannen MeleMannen commented Sep 14, 2026

Copy link
Copy Markdown

This PR adds a /contact endpoint that sends emails through a reusable Nodemailer mail service.

Changes

  • Added contact email route with request validation
  • Added Gmail OAuth2-based mail sending
  • Registered the route in the API

Notes

  • Only predefined Vektor email addresses are allowed
  • Requires Google OAuth2 environment variables to be configured

Closes #144

@MeleMannen MeleMannen changed the title Add contact form support in backend Added contact form support in backend Sep 14, 2026
Comment thread src/services/mail-service.ts Fixed
@MeleMannen MeleMannen self-assigned this Sep 14, 2026
@sonarqubecloud

Copy link
Copy Markdown

@kyrkjedelen kyrkjedelen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To foreslåtte forandringer :D

Comment thread src/routers/contact.ts

const { receivingEmail, replyTo, about, text } = result.data;

const validEmailAddresses = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kan ikke ha magic konstanter, vurder å legg det til i en global variabel, konfig fil eller databasen

service: "gmail",
auth: {
type: "OAuth2",
user: process.env.GOOGLE_FROM_EMAIL,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vurder å bruke allerede eksisterende environment variabel parsere her

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a new send email route that sends an email from noreply@vektorprogrammet.no to an email address.

3 participants