fix: add and change many email-related environment variables
This commit is contained in:
parent
3ffb81d020
commit
e961bd557c
4 changed files with 23 additions and 16 deletions
|
@ -8,8 +8,14 @@ ADMIN_PASSWORD=
|
||||||
|
|
||||||
NEXTAUTH_SECRET=
|
NEXTAUTH_SECRET=
|
||||||
|
|
||||||
EMAIL=
|
EMAIL_SERVER=
|
||||||
|
EMAIL_PORT=
|
||||||
|
EMAIL_SECURE=
|
||||||
|
EMAIL_USER=
|
||||||
EMAIL_PASS=
|
EMAIL_PASS=
|
||||||
|
EMAIL_NEWSLETTER_ADDRESS=
|
||||||
|
EMAIL_CONTACT_ADDRESS=
|
||||||
|
EMAIL_CONTACT_DEST=
|
||||||
|
|
||||||
SANITY_PROJECT_ID=
|
SANITY_PROJECT_ID=
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ import nodemailer from "nodemailer";
|
||||||
import clientPromise from "@/lib/db";
|
import clientPromise from "@/lib/db";
|
||||||
|
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
host: "smtp.ethereal.email", //replace this also comment this if u not using etheral
|
host: process.env.EMAIL_SERVER,
|
||||||
// service: "gmail", // uncomment if u using gmail
|
port: parseInt(process.env.EMAIL_PORT ? process.env.EMAIL_PORT : "25"),
|
||||||
port: 587,
|
secure: Boolean(process.env.EMAIL_SECURE ? process.env.EMAIL_SECURE : false),
|
||||||
auth: {
|
auth: {
|
||||||
user: process.env.EMAIL,
|
user: process.env.EMAIL_USER,
|
||||||
pass: process.env.EMAIL_PASS
|
pass: process.env.EMAIL_PASS
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ const transporter = nodemailer.createTransport({
|
||||||
const sendEmail = async (to: string[], subject: string, html: string) => {
|
const sendEmail = async (to: string[], subject: string, html: string) => {
|
||||||
try {
|
try {
|
||||||
await transporter.sendMail({
|
await transporter.sendMail({
|
||||||
from: process.env.EMAIL_USER,
|
from: process.env.EMAIL_NEWSLETTER_ADDRESS,
|
||||||
to: to.join(", "),
|
to: to.join(", "),
|
||||||
subject: subject,
|
subject: subject,
|
||||||
html: html
|
html: html
|
||||||
|
|
|
@ -2,11 +2,11 @@ import { NextRequest, NextResponse } from "next/server";
|
||||||
import nodemailer from "nodemailer";
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
host: "smtp.ethereal.email", // Replace with your SMTP host
|
host: process.env.EMAIL_SERVER,
|
||||||
// service: "gmail", // Uncomment if using Gmail
|
port: parseInt(process.env.EMAIL_PORT ? process.env.EMAIL_PORT : "25"),
|
||||||
port: 587,
|
secure: Boolean(process.env.EMAIL_SECURE ? process.env.EMAIL_SECURE : false),
|
||||||
auth: {
|
auth: {
|
||||||
user: process.env.EMAIL,
|
user: process.env.EMAIL_USER,
|
||||||
pass: process.env.EMAIL_PASS
|
pass: process.env.EMAIL_PASS
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ const transporter = nodemailer.createTransport({
|
||||||
const sendEmail = async (to: string[], subject: string, html: string) => {
|
const sendEmail = async (to: string[], subject: string, html: string) => {
|
||||||
try {
|
try {
|
||||||
await transporter.sendMail({
|
await transporter.sendMail({
|
||||||
from: process.env.EMAIL_USER,
|
from: process.env.EMAIL_NEWSLETTER_ADDRESS,
|
||||||
to: to.join(", "),
|
to: to.join(", "),
|
||||||
subject: subject,
|
subject: subject,
|
||||||
html: html
|
html: html
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
import nodemailer from "nodemailer";
|
import nodemailer from "nodemailer";
|
||||||
|
|
||||||
export const transporter = nodemailer.createTransport({
|
export const transporter = nodemailer.createTransport({
|
||||||
host: "smtp.ethereal.email",
|
host: process.env.EMAIL_SERVER,
|
||||||
port: 587,
|
port: parseInt(process.env.EMAIL_PORT ? process.env.EMAIL_PORT : "25"),
|
||||||
|
secure: Boolean(process.env.EMAIL_SECURE ? process.env.EMAIL_SECURE : false),
|
||||||
auth: {
|
auth: {
|
||||||
user: process.env.EMAIL,
|
user: process.env.EMAIL_USER,
|
||||||
pass: process.env.EMAIL_PASS
|
pass: process.env.EMAIL_PASS
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const mailOptions = {
|
export const mailOptions = {
|
||||||
from: process.env.EMAIL,
|
from: process.env.EMAIL_CONTACT_ADDRESS,
|
||||||
to: process.env.EMAIL,
|
to: process.env.EMAIL_CONTACT_DEST,
|
||||||
html: `
|
html: `
|
||||||
<table bgcolor="#fafafa" style=" width: 100%!important; height: 100%; background-color: #fafafa; padding: 20px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 100%; line-height: 1.6;">
|
<table bgcolor="#fafafa" style=" width: 100%!important; height: 100%; background-color: #fafafa; padding: 20px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 100%; line-height: 1.6;">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in a new issue