Write Express server to send email
In this article, I would like to share how to write a Node.js program to send email via Gmail SMTP server, and then deploy it to Google Cloud.

Search for a command to run...
In this article, I would like to share how to write a Node.js program to send email via Gmail SMTP server, and then deploy it to Google Cloud.

No comments yet. Be the first to comment.
In this article, I would like to document how I created a React component and published it. Prerequisites Install NodeJs. On Ubuntu. apt install node Install NPM. On Ubuntu. apt install npm Install required libraries. npm install react reac...
In this article, we'll write a JUnit Test configured with Environment Variables using junit-pioneer library. First of all, we need to add the junit-pioneer library and maven-surefire-plugin to the Maven pom.xml. <project> <properties> <p...
Problem The problem occurs when using the Python requests library, the chardet library is not installed. /Users/adacheng/Library/Python/3.9/lib/python/site-packages/requests/__init__.py:86: RequestsDependencyWarning: Unable to find acceptable charact...

Apache Kafka is an open-source distributed event streaming platform for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications. Introduction This article aims to provide basic hands-on instructions ...

Problem When AWS STS module is included in a Spring Boot Application, exception complaining region not set is thrown. Maven pom.xml <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>sts</artifactId> </dependency> Error M...

Installation Follow the instruction in this article to install Trivy. Scan To scan the docker image: Build the image. docker build . -t hello-world Scan the image. trivy scan hello-world

First of all, create App Password to be used in the program. Due to security reason, Google does not allow non Google-app to sign in. It is required to explicitly generate an App Password to use.
In order to generate App Password:
Reference: Sign in with App Passwords
Create package.json.
{
"name": "contact-form-server",
"description": "This script serves as a server to accept and process request from a Contact Form, and then send to data to a destination email",
"scripts": {
"start": "node contact_form_server.js"
},
"version": "0.0.1",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"nodemailer": "^6.7.1"
}
}
Create contact_form_server.js (you can have another js script filename, but make sure to change the script name of the "scripts:start" entry in package.json) as the Node.js script.
Start the program locally for testing.
npm start
Create a HTML form for testing.
Create app.yaml for Google Cloud deployment.
runtime: nodejs14
Enable Cloud Build API. Set the appropriate credential.
gcloud app deploy