e-mail function changed

This commit is contained in:
xfarrow 2024-03-11 11:50:25 +01:00
parent 6d79cb04d9
commit 4564ec84f0
2 changed files with 13 additions and 11 deletions

View File

@ -18,4 +18,4 @@ POSTGRES_PORT = 5432
# Application settings
ALLOW_USER_REGISTRATION = true
NEEDS_EMAIL_VERIFICATION = true # Does this server need users to verify their e-mail address?
NEEDS_EMAIL_VERIFICATION = false # Does this server need users to verify their e-mail address?

View File

@ -9,19 +9,21 @@ let transporter = nodemailer.createTransport({
}
});
function sendConfirmationLink(destinationEmail, code) {
function sendConfirmationLink(destinationAddress, code) {
const confirmationLink = `${process.env.FRONT_END_URL}/activate-account.html?q=${code}`
let mailOptions = {
from: `"Blink" ${process.env.SMTP_USERNAME}`,
to: destinationEmail,
subject: 'Verify your Blink Account',
// text: 'This is plain HTML',
html: getConfirmationLinkHtmlPage(confirmationLink)
};
sendMail(mailOptions);
sendMail(destinationAddress, 'Verify your Blink Account', null, getConfirmationLinkHtmlPage(confirmationLink));
}
function sendMail(mailOptions) {
function sendMail(destinationAddress, subject, text, html) {
let mailOptions = {
from: `"Blink" ${process.env.SMTP_USERNAME}`,
to: destinationAddress,
subject: subject,
text: text, // plain text
html: html
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.error(error);