๐๐ป SMTP(Simple Mail Transfer Protocol) ๋ฉ์ผ ๋ฐ์ก์ ์๋น์ค ๋ํด์ ์๊ฐํ๊ณ ์ ํฉ๋๋ค.
I would like to introduce the SMTP (Simple Mail Transfer Protocol) email sending service.
๐๐ป ์ฑ์ผ๋ก ํ์๊ฐ์
๊ธฐ๋ฅ์ ๋ง๋ค๊ฑฐ๋ ๋น์ง๋์ค๋ฅผ ์ํด์ ๊ด๊ณ ๋ ์์์ ์ ๋ฌํ ๊ฒฝ์ฐ ์ด๋ฉ์ผ์ด ํ์ํฉ๋๋ค.
An email address is required when implementing a sign-up feature in an app or when delivering advertisements or news for business purposes.
๐๐ป ๊ทธ๋ฆฌ๊ณ ์ง๊ธ ๋ง๋ค๊ณ ํ๋ก์ฐ ๊ธฐ๋ฅ์ ๋ง๋ค๊ณ ์๋ nextjs sns์๋น์ค์๋ ๋ฉ์ผ ์๋น์ค๊ฐ ํ์ํฉ๋๋ค.
Also, the Next.js-based social networking service I am currently buildingโwhich includes a follow featureโrequires an email service.
๐๐ป ์ด๋ด ๊ฒฝ์ฐ ๋ฉ์ผ์ ๋ฐ์กํ๊ธฐ ์ํด์๋ SMTP ์๋ฒ๊ฐ ํ์ํ๊ฒ๋ฉ๋๋ค.
In this case, an SMTP server is required to send emails.
๐๐ป SMTP์๋ฒ๋ ๊ฐ๋จํ ์ง์ ๊ตฌ์ถํ ์ ์์ต๋๋ค.
You can easily set up an SMTP server yourself.
๐๐ป ํ์ง๋ง ์์ฆ ์คํธ๋ฉ์ผ์ด ๋๋ฌด ๋ง์์ ์น ๋ฉ์ผ์๋น์ค๋ฅผ ์ ๊ณตํ๋ ์
์ฒด์์ ์คํธ๋ฉ์ผ์ ๋ํ ์ ์ฑ
์ด ๋งค์ฐ ๊ฐํ๊ฒ ์ ์ฉ๋๊ณ ์์ต๋๋ค.
However, due to the sheer volume of spam emails these days, webmail service providers are enforcing very strict policies regarding spam.
๐๐ป ๋๋ถ๋ถ์ ๋ฉ์ผ์๋น์ค๋ ํฌํธ ์ฌ์ดํธ ๋ฉ์ผ์ ๋ง์ด ์ฌ์ฉํฉ๋๋ค.
Most people use email services provided by portal sites.
๐๐ป ์ ํํ๊ฒ ํฌํธ ์ฌ์ดํธ ๋ฉ์ผํจ์ ๋ด ๋ฉ์ผ์ด ๋์ฐฉํ๊ฒ ํ๊ธฐ ์ํด์ ์ค์ ์ ๋ง์ ๋ถํธํจ์ด ์๊ธฐ ๋๋ฌธ์ ์ธ๋ถ์
์ฒด์ ๋ฉ์ผ๋ฐ์ก ์๋น์ค๋ฅผ ๋ง์ด ์ฌ์ฉํฉ๋๋ค.
Configuring settings to ensure emails reliably reach the inboxes of major portal sites can be quite cumbersome, which is why many people use third-party email delivery services.
๐๐ป ๋ง์ ๋ํ์ ์ผ๋ก ์ฌ์ฉํ ์ ์๋ ๊ณณ์ด Breavo.com์ด๋ ๊ณณ์ด ์์ต๋๋ค.
One prominent example of a service you can use is Breavo.com.
๐๐ป ๋ฌด๋ฃ ํ๋์ผ๋ก ๊ฐ์
ํ๋ฉด ํ๋ฃจ์ 300ํต์ ๋ฉ์ผ์ ๋ฌด๋ฃ๋ก ์ ์กํ ์ ์์ต๋๋ค.
If you sign up for the free plan, you can send 300 emails per day for free.
๐๐ป nodejs์ ์ด์ฉํด์ ์ ๊ฐ ์ฌ์ฉํ๋ ํฌํธ ์ฌ์ดํธ์ ๋ฉ์ผํจ์ผ๋ก ๋ฉ์ผ์ ๋ณด๋ด๋ด
๋๋ค.
I am using Node.js to send an email to the inbox of the portal site I use.
๐ Brevo.com ํ์๊ฐ์
๋ฐ ์ค์
Brevo.com Sign-up and Setup
โ๏ธ ์ ๋ ๊ฐ๋จํ ์์
๋ก๊ทธ์ธ์ ์ด์ฉํด์ ๊ตฌ๊ธ๊ณ์ ์ผ๋ก ๊ฐ์
ํ์ต๋๋ค.
I simply signed up using my Google account via social login.
โ๏ธ ์๋๋ Breavo.com์์ smtp key๋ฅผ ๋ฐ๋ ๊ณผ์ ์ ๋๋ค.
1) ๋ธ๋ผ์ฐ์ ํ๋ฉด ์๋๋ก ๋ด๋ฆฌ๋ฉด Free Plan ์ ์ ํ ํ ์ ์์ต๋๋ค.
Scroll down the browser screen to select the Free Plan.

2) ๋ชจ๋ง์ผ ํฐ ์ธ์ฆ / Mobile phone verification


3)SMTP ํค ์์ฑ / Generate SMTP Key
3-1) ์ฐ์ธก์ ํ๋กํ ๋ฉ๋ด๋ฅผ ์ ํํ๋ฉด ์ผ์ชฝ์ SMTP & API ๋ฉ๋ด๋ฅผ ๋ณผ ์ ์์ต๋๋ค.
If you select the profile menu on the right, you can see the SMTP & API menu on the left.


๐ Nodejs ํ๋ก์ ํธ ์์ฑ
Create a Node.js project
npm init -y
๐ nodemailer ๋ชจ๋ ์ค์น
Install the nodemailer module.
npm install nodemailer
๐ package.json ์ฝ๋ ์์
Modify package.json code
โ๏ธ import๊ตฌ๋ฌธ์ ์ฌ์ฉํ๊ธฐ ์ํด์ type: “commonjs”๋ฅผ type:”module”๋ก ๋ณ๊ฒฝํฉ๋๋ค.
To use the import statement, change type: "commonjs" to type: "module".
{
"name": "breavo-smtp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"dependencies": {
"nodemailer": "^9.0.5"
}
}
๐ send.js ์ฝ๋์์ฑ / Writing the send.js code
import nodemailer from "nodemailer";
const transporter = nodemailer.createTransport({
host: "smtp.brevo.com",
port: 587,
secure: false, // 587 ํฌํธ๋ STARTTLS ๋ฐฉ์์ ์ฐ๋ฏ๋ก false๋ก ๋ก๋๋ค. / The 587 port uses STARTTLS, so set it to false.
auth: {
user: "๋ณธ์ธ์ Brevo ๊ฐ์
์ด๋ฉ์ผ ์ฃผ์ / Your Brevo account email address",
pass: "64์๋ฆฌ ๋น๋ฐํค / Your 64-character secret key"
}
});
const mailOptions = {
// ๋ฐ์ ์์ ID๋ฅผ ์ผ์น์์ผ ์ค๋๋ค. / Make sure the sender matches the ID.
from: "๋ณธ์ธ์ Brevo ๊ฐ์
์ด๋ฉ์ผ ์ฃผ์ / Your Brevo account email address",
to: "ํ์ธํด ๋ณผ ๋ณธ์ธ์ ๋ค๋ฅธ ๊ฐ์ธ ์ด๋ฉ์ผ (์ง๋ฉ์ผ, ๋ค์ด๋ฒ,๋ค์ ๋ฑ) / The other personal email you want to check (e.g., Gmail, Naver,Daum etc.)",
subject: "Brevo SMTP ์ด๊ฐ๋จ ์ฐ๋ ํ
์คํธ / Simple Brevo SMTP Integration Test",
text: "๋ฉ์ผ ๋ฐ์ก ์ฑ๊ณตํ์ต๋๋ค! / Email sent successfully!"
};
async function sendTest() {
try {
const info = await transporter.sendMail(mailOptions);
console.log("โ
๋ฐ์ก ์ฑ๊ณต! ๋ฉ์์ง / Success! Message ID:", info.messageId);
} catch (error) {
console.error("โ ๋ฐ์ก ์คํจ ์๋ฌ ๋ด์ฉ / Error occurred while sending email:", error);
}
}
sendTest();
โ๏ธ ๋ฉ์ผ ๋ฐ์ก์๋ฃ / Email sent successfully.
node send.js
breavo-smtp % node send.js
โ
๋ฐ์ก ์ฑ๊ณต! ๋ฉ์์ง / Success! Message ID: <fd1f1954-63e5-6502-1252-14a0ae09758a@gmail.com>
1)ํ
์คํธ ๊ฒฐ๊ณผ ๋ค์ด๋ฒ,์ง๋ฉ์ผ์ ์ ์์ ์ผ๋ก๋ฉ์ผ ๋์ฐฉํ์ธํ๊ณ ๋ค์์ ๋ฉ์ผ์ด ๋์ฐฉํ์ง ์์์ต๋๋ค.
Test results showed that emails arrived normally for Naver and Gmail, but the email did not arrive for Daum.
2) ๋ค์์ ์์ฒด ๋ฉ์ผ ์ ์ฑ
์ผ๋ก ์ธํด ๋ฉ์ผ์ด ๋์ฐฉํ์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค.
It appears that the email did not arrive due to internal email policies.


์ํ๋ณต์ 8์ฅ 32์ / John 8:32
“๊ทธ๋ฆฌ๊ณ ๋ํฌ๋ ์ง๋ฆฌ๋ฅผ ์๊ฒ ๋ ๊ฒ์ด๋ฉฐ, ์ง๋ฆฌ๊ฐ ๋ํฌ๋ฅผ ์์ ๋กญ๊ฒ ํ ๊ฒ์ด๋ค.”
“Then you will know the truth ,and the truth will set you free”