site logo

6 Redesigning my portfolio app

Upgrading from HTML, CSS, JS to Next.JS and GraphQL

Contact Page is activated

Today I worked on integrating a SendGrid email functionality on the Contact form. It was fairly easy to setup once I figured out how to correctly set my environment variables.

I have set up a way to send a Thank You email to the user on Contact form submission. I need to duplicate the functionality so I can forward the user's message to myself on another email.

const sgMail = require("@sendgrid/mail")

export default function handler(req, res) {
  const body = req.body
  if (! || ! || !body.message) {
    return res
      .json({ data: "name, email and message are required" })
  const msg = {
    from: process.env.SENDER,
    subject: "Thanks for reaching out, " +,
    text: "I will get back to you as soon as possible!",
    html: "<strong>I will get back to you as soon as possible!</strong>",
    .then(() => {
      console.log("Email sent")
    .catch((error) => {


Testing the Contact form

I have tested the email sending part manually and the SendGrid platform is having trouble delivering the emails, but so far the contact page is behaving normally. I will move on the other tasks for now and circle back later

Screenshot from 2022-11-06 03-20-47.png

You are welcome to visit the current version of the site at

© 2019-2024 - CodenificienT - All right reserved